⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 date.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
characters (for example, single- as opposed to multi-byte charactersin arguments).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>LC_TIME</i><dd>Determine the format and contents of date and timestrings written by<i>date</i>.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i><dt><i>TZ</i><dd>Determine the timezone in which the time and date arewritten, unless the<b>-u</b>option is specified.If the<i>TZ</i>variable is not set and the<b>-u</b>is not specified, an unspecified system default timezone is used.</dl></blockquote><h4><a name = "tag_001_014_347">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_348">&nbsp;</a>STDOUT</h4><blockquote>When no formatting operand is specified, the outputin the POSIX locale is equivalent to specifying:<pre><code>date "+%a %b %e %H:%M:%S %Z %Y"</code></pre></blockquote><h4><a name = "tag_001_014_349">&nbsp;</a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_350">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_351">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_352">&nbsp;</a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>The date was written successfully.<dt>&gt;0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_353">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_354">&nbsp;</a>APPLICATION USAGE</h4><blockquote>Field descriptors are of unspecified format when not in thePOSIX locale.Some of them can containnewline charactersin some locales, so it may be difficult to use the format shown instandard output for parsing the output of<i>date</i>in those locales.<p>The range of values for<b>%S</b>extends from 0 to 61 seconds to accommodate the occasional leap secondor double leap second.<p>Although certain of the field descriptors in the POSIX locale(such as the name of the month)are shown with initial capital letters, this need not bethe case in other locales.Programs using these fields may need to adjust the capitalisationif the output is going to be used at the beginning of a sentence.<p>The date string formatting capabilities are intended for use inGregorian style calendars, possibly with a different startingyear (or years).The<b>%x</b>and<b>%c</b>field descriptors, however, areintended for local representation;these may be based on adifferent, non-Gregorian calendar.<p>The<b>%C</b>field descriptor was introduced to allow a fallback for the<b>%EC</b>(alternative year format base year);it can be viewed asthe base of the current subdivision in the Gregorian calendar.A century is not calculated as an ordinal number;this Guide was published in century 19, not the twentieth.Both the<b>%Ey</b>and<b>%y</b>can then be viewed as the offset from<b>%EC</b>and<b>%C</b>,respectively.<p>TheEandOmodifiers modify the traditional field descriptors,so that they can always be used, even if the implementation (orthe current locale) does not support the modifier.<p>TheEmodifier supports alternative date formats, such as theJapanese Emperor's Era, as long as these are based on theGregorian calendar system.Extending theEmodifiers to otherdate elements may provide an implementation-dependent extensioncapable of supporting other calendar systems, especially incombination with theOmodifier.<p>TheOmodifier supports time and date formats using the locale's alternativenumerical symbols, such as Kanji or Hindi digits or ordinalnumber representation.<p>Non-European locales, whether they use Latin digitsin computational items or not, often have local forms ofthe digits for use in date formats.This is not totally unknown even in Europe;a variant of dates uses Roman numerals for the months:the third day of September 1991 would bewritten as 3.IX.1991.In Japan, Kanji digits are regularly used for dates;in Arabic-speaking countries, Hindi digits are used.The<b>%d</b>,<b>%e</b>,<b>%H</b>,<b>%I</b>,<b>%m</b>,<b>%S</b>,<b>%U</b>,<b>%w</b>,<b>%W</b>and<b>%y</b>field descriptorsalways return the date and time field in Latin digits (that is, 0 to 9).The<b>%O</b>modifier was introduced to support the usefor display purposes of non-Latin digits.In the LC_TIME categoryin<i><a href="localedef.html">localedef</a></i>,the optional<b>alt_digits</b>keyword is intendedfor this purpose.As an example, assume the following (partial)<i><a href="localedef.html">localedef</a></i>source:<pre><code>alt_digits    "";"I";"II";"III";"IV";"V";"VI";"VII";"VIII" \              "IX";"X";"XI";"XII"d_fmt         "%e.%Om.%Y"</code></pre>With the above date, the command:<pre><code>date "+%x"</code></pre>would yield 3.IX.1991.With the same<b>d_fmt</b>,but without the<b>alt_digits</b>,the command would yield 3.9.1991.</blockquote><h4><a name = "tag_001_014_355">&nbsp;</a>EXAMPLES</h4><blockquote><ol><p><li>The following are input/output examples of<i>date</i>used at arbitrary times in the POSIX locale:<pre><code><b>$</b> date<b>Tue Jun 26 09:58:10 PDT 1990</b></code></pre><pre><code><b>$</b> date "+DATE: %m/%d/%y%nTIME: %H:%M:%S"<b>DATE: 11/02/91TIME: 13:36:16</b></code></pre><pre><code><b>$</b> date "+TIME: %r"<b>TIME: 01:36:32 PM</b></code></pre><p><li>Examples for Denmark, where thedefault date and time format is"%a %d %b %Y %T %Z":<pre><code><b>$</b> LANG=da_DK.iso_8859-1 date<b>ons 02 okt 1991 15:03:32 CET</b></code></pre><pre><code><b>$</b> LANG=da_DK.iso_8859-1 date"+DATO:%Aden%e.%B%Y%nKLOKKEN:%H:%M:%S"<b>DATO: onsdag den  2. oktober 1991KLOKKEN: 15:03:56</b></code></pre><p><li>Examples for Germany, where thedefault date and time format is"%a %d.%h.%Y, %T %Z":<pre><code><b>$</b> LANG=De_DE.88591 date<b>Mi 02.Okt.1991, 15:01:21 MEZ</b></code></pre><pre><code><b>$</b> LANG=De_DE.88591 date "+DATUM: %A, %d. %B %Y%nZEIT:  %H:%M:%S" <b>DATUM: Mittwoch, 02. Oktober 1991ZEIT:  15:02:02</b></code></pre><br><p><li>Examples for France, where thedefault date and time format is"%a %d %h %Y %Z %T":<pre><code><b>$</b> LANG=Fr_FR.88591 date<b>Mer 02 oct 1991 MET 15:03:32</b></code></pre><pre><code><b>$</b> LANG=Fr_FR.88591 date "+JOUR:  %A %d %B %Y%nHEURE: %H:%M:%S"<b>JOUR:  Mercredi 02 octobre 1991HEURE: 15:03:56</b></code></pre><p></ol></blockquote><h4><a name = "tag_001_014_356">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_357">&nbsp;</a>SEE ALSO</h4><blockquote>The <b>XSH</b> specification description of<i><a href="../xsh/ctime.html">ctime()</a></i>,<i><a href="../xsh/printf.html">printf()</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -