📄 date.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>date</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="date"></a> <a name="tag_04_33"></a><!-- date --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_33_01"></a>NAME</h4><blockquote>date - write the date and time</blockquote><h4><a name="tag_04_33_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>date</tt> <b>[</b><tt>-u</tt><b>] [</b><tt>+</tt><i>format</i><b>]</b><tt><br><br></tt></code></p><div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> date</tt> <b>[</b><tt>-u</tt><b>]</b><i>mmddhhmm</i><b>[[</b><i>cc</i><b>]</b><i>yy</i><b>]</b><tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_04_33_03"></a>DESCRIPTION</h4><blockquote><p>The <i>date</i> utility shall write the date and time to standard output <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> or attemptto set the system date and time. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> By default, the current date andtime shall be written. If an operand beginning with <tt>'+'</tt> is specified, the output format of <i>date</i> shall be controlledby the conversion specifications and other text in the operand.</p></blockquote><h4><a name="tag_04_33_04"></a>OPTIONS</h4><blockquote><p>The <i>date</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>The following option shall be supported:</p><dl compact><dt><b>-u</b></dt><dd>Perform operations as if the <i>TZ</i> environment variable was set to the string <tt>"UTC0"</tt> , or its equivalenthistorical value of <tt>"GMT0"</tt> . Otherwise, <i>date</i> shall use the timezone indicated by the <i>TZ</i> environment variableor the system default if that variable is unset or null.</dd></dl></blockquote><h4><a name="tag_04_33_05"></a>OPERANDS</h4><blockquote><p>The following operands shall be supported:</p><dl compact><dt>+<i>format</i></dt><dd>When the format is specified, each conversion specifier shall be replaced in the standard output by its corresponding value.All other characters shall be copied to the output without change. The output shall always be terminated with a<newline>.</dd></dl><h5><a name="tag_04_33_05_01"></a>Conversion Specifications</h5><dl compact><dt><tt>%a</tt></dt><dd>Locale's abbreviated weekday name.</dd><dt><tt>%A</tt></dt><dd>Locale's full weekday name.</dd><dt><tt>%b</tt></dt><dd>Locale's abbreviated month name.</dd><dt><tt>%B</tt></dt><dd>Locale's full month name.</dd><dt><tt>%c</tt></dt><dd>Locale's appropriate date and time representation.</dd><dt><tt>%C</tt></dt><dd>Century (a year divided by 100 and truncated to an integer) as a decimal number [00,99].</dd><dt><tt>%d</tt></dt><dd>Day of the month as a decimal number [01,31].</dd><dt><tt>%D</tt></dt><dd>Date in the format <i>mm</i>/<i>dd</i>/<i>yy</i>.</dd><dt><tt>%e</tt></dt><dd>Day of the month as a decimal number [1,31] in a two-digit field with leading space character fill.</dd><dt><tt>%h</tt></dt><dd>A synonym for <tt>%b</tt> .</dd><dt><tt>%H</tt></dt><dd>Hour (24-hour clock) as a decimal number [00,23].</dd><dt><tt>%I</tt></dt><dd>Hour (12-hour clock) as a decimal number [01,12].</dd><dt><tt>%j</tt></dt><dd>Day of the year as a decimal number [001,366].</dd><dt><tt>%m</tt></dt><dd>Month as a decimal number [01,12].</dd><dt><tt>%M</tt></dt><dd>Minute as a decimal number [00,59].</dd><dt><tt>%n</tt></dt><dd>A <newline>.</dd><dt><tt>%p</tt></dt><dd>Locale's equivalent of either AM or PM.</dd><dt><tt>%r</tt></dt><dd>12-hour clock time [01,12] using the AM/PM notation; in the POSIX locale, this shall be equivalent to <tt>%I</tt> : <tt>%M</tt>: <tt>%S</tt> <tt>%p</tt> .</dd><dt><tt>%S</tt></dt><dd>Seconds as a decimal number [00,60].</dd><dt><tt>%t</tt></dt><dd>A <tab>.</dd><dt><tt>%T</tt></dt><dd>24-hour clock time [00,23] in the format <i>HH</i>:<i>MM</i>:<i>SS</i>.</dd><dt><tt>%u</tt></dt><dd>Weekday as a decimal number [1,7] (1=Monday).</dd><dt><tt>%U</tt></dt><dd>Week of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the firstSunday shall be considered to be in week 0.</dd><dt><tt>%V</tt></dt><dd>Week of the year (Monday as the first day of the week) as a decimal number [01,53]. If the week containing January 1 has fouror more days in the new year, then it shall be considered week 1; otherwise, it shall be the last week of the previous year, andthe next week shall be week 1.</dd><dt><tt>%w</tt></dt><dd>Weekday as a decimal number [0,6] (0=Sunday).</dd><dt><tt>%W</tt></dt><dd>Week of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the firstMonday shall be considered to be in week 0.</dd><dt><tt>%x</tt></dt><dd>Locale's appropriate date representation.</dd><dt><tt>%X</tt></dt><dd>Locale's appropriate time representation.</dd><dt><tt>%y</tt></dt><dd>Year within century [00,99].</dd><dt><tt>%Y</tt></dt><dd>Year with century as a decimal number.</dd><dt><tt>%Z</tt></dt><dd>Timezone name, or no characters if no timezone is determinable.</dd><dt><tt>%%</tt></dt><dd>A percent sign character.</dd></dl><p>See the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap07.html#tag_07_03_05">Section7.3.5, LC_TIME</a> for the conversion specifier values in the POSIX locale.</p><h5><a name="tag_04_33_05_02"></a>Modified Conversion Specifications</h5><p>Some conversion specifiers can be modified by the <tt>E</tt> and <tt>O</tt> modifier characters to indicate a different formator specification as specified in the <i>LC_TIME</i> locale description (see the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap07.html#tag_07_03_05">Section 7.3.5, LC_TIME</a>). If thecorresponding keyword (see <b>era</b>, <b>era_year</b>, <b>era_d_fmt</b>, and <b>alt_digits</b> in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap07.html#tag_07_03_05">Section 7.3.5, LC_TIME</a>) is not specified ornot supported for the current locale, the unmodified conversion specifier value shall be used.</p><dl compact><dt><tt>%Ec</tt></dt><dd>Locale's alternative appropriate date and time representation.</dd><dt><tt>%EC</tt></dt><dd>The name of the base year (period) in the locale's alternative representation.</dd><dt><tt>%Ex</tt></dt><dd>Locale's alternative date representation.</dd><dt><tt>%EX</tt></dt><dd>Locale's alternative time representation.</dd><dt><tt>%Ey</tt></dt><dd>Offset from <tt>%EC</tt> (year only) in the locale's alternative representation.</dd><dt><tt>%EY</tt></dt><dd>Full alternative year representation.</dd><dt><tt>%Od</tt></dt><dd>Day of month using the locale's alternative numeric symbols.</dd><dt><tt>%Oe</tt></dt><dd>Day of month using the locale's alternative numeric symbols.</dd><dt><tt>%OH</tt></dt><dd>Hour (24-hour clock) using the locale's alternative numeric symbols.</dd><dt><tt>%OI</tt></dt><dd>Hour (12-hour clock) using the locale's alternative numeric symbols.</dd><dt><tt>%Om</tt></dt><dd>Month using the locale's alternative numeric symbols.</dd><dt><tt>%OM</tt></dt><dd>Minutes using the locale's alternative numeric symbols.</dd><dt><tt>%OS</tt></dt><dd>Seconds using the locale's alternative numeric symbols.</dd><dt><tt>%Ou</tt></dt><dd>Weekday as a number in the locale's alternative representation (Monday = 1).</dd><dt><tt>%OU</tt></dt><dd>Week number of the year (Sunday as the first day of the week) using the locale's alternative numeric symbols.</dd><dt><tt>%OV</tt></dt><dd>Week number of the year (Monday as the first day of the week, rules corresponding to <tt>%V</tt> ), using the locale'salternative numeric symbols.</dd><dt><tt>%Ow</tt></dt><dd>Weekday as a number in the locale's alternative representation (Sunday = 0).</dd><dt><tt>%OW</tt></dt><dd>Week number of the year (Monday as the first day of the week) using the locale's alternative numeric symbols.</dd><dt><tt>%Oy</tt></dt><dd>Year (offset from <tt>%C</tt> ) in alternative representation.</dd></dl><br><dl compact><dt><i>mmddhhmm</i><b>[[</b><i>cc</i><b>]</b><i>yy</i><b>]</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"><br>Attempt to set the system date and time from the value given in the operand. This is only possible if the user has appropriateprivileges and the system permits the setting of the system date and time. The first <i>mm</i> is the month (number); <i>dd</i> isthe day (number); <i>hh</i> is the hour (number, 24-hour system); the second <i>mm</i> is the minute (number); <i>cc</i> is thecentury and is the first two digits of the year (this is optional); <i>yy</i> is the last two digits of the year and is optional.If century is not specified, then values in the range [69,99] shall refer to years 1969 to 1999 inclusive, and values in the range[00,68] shall refer to years 2000 to 2068 inclusive. The current year is the default if <i>yy</i> is omitted. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> <basefont size="2"> <dl><dt><b>Note:</b></dt><dd>It is expected that in a future version of IEEE Std 1003.1-2001 the default century inferred from a 2-digit year willchange. (This would apply to all commands accepting a 2-digit year as input.)</dd></dl><basefont size="3"></dd></dl></blockquote><h4><a name="tag_04_33_06"></a>STDIN</h4>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -