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

📄 date.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>date</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_339">&nbsp;</a>NAME</h4><blockquote>date - write the date and time</blockquote><h4><a name = "tag_001_014_340">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>date <b>[</b>-u<b>] [</b>+<i>format</i><b>]</b>date <b>[</b>-u<b>] </b><i>mmddhhmm</i><b>[[</b><i>cc</i><b>]</b><i>yy</i><b>] </b></code></pre></blockquote><h4><a name = "tag_001_014_341">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>date</i>utility writes the date and time to standard outputor attempts to set the system date and time.&nbsp;By default, the current date and time will be written.If an operand beginning with"+"is specified, the output format of<i>date</i>will be controlled by the field descriptors and other text in the operand.</blockquote><h4><a name = "tag_001_014_342">&nbsp;</a>OPTIONS</h4><blockquote>The<i>date</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> .<p>The following option is supported:<dl compact><dt><b>-u</b><dd>Perform operations as if the<i>TZ</i>environment variable was set to the stringUTC0,or its equivalent historical value ofGMT0.Otherwise,<i>date</i>will use the timezone indicated by the<i>TZ</i>environment variable or the system default if that variable is not set.</dl></blockquote><h4><a name = "tag_001_014_343">&nbsp;</a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt>+<i>format</i><dd>When the format is specified, each field descriptorwill be replaced in the standard output byits corresponding value.All other characters will be copied to the output without change.The output will always be terminated with anewlinecharacter.</dl><h5><a name = "tag_001_014_343_001">&nbsp;</a>Field Descriptors</h5><dl compact><dt><b>%a</b><dd>Locale's abbreviated weekday name.<dt><b>%A</b><dd>Locale's full weekday name.<dt><b>%b</b><dd>Locale's abbreviated month name.<dt><b>%B</b><dd>Locale's full month name.<dt><b>%c</b><dd>Locale's appropriate date and time representation.<dt><b>%C</b><dd>Century (a year divided by 100 and truncated to an integer)as a decimal number [00-99].<dt><b>%d</b><dd>Day of the month as a decimal number [01-31].<dt><b>%D</b><dd>Date in the format<i>mm/dd/yy .</i><dt><b>%e</b><dd>Day of the month as a decimal number[1-31] in a two-digit field with leadingspace characterfill.<dt><b>%h</b><dd>A synonym for<b>%b</b>.<dt><b>%H</b><dd>Hour (24-hour clock) as a decimal number [00-23].<dt><b>%I</b><dd>Hour (12-hour clock) as a decimal number [01-12].<dt><b>%j</b><dd>Day of the year as a decimal number [001-366].<dt><b>%m</b><dd>Month as a decimal number [01-12].<dt><b>%M</b><dd>Minute as a decimal number [00-59].<dt><b>%n</b><dd>Anewlinecharacter.<dt><b>%p</b><dd>Locale's equivalent of eitherAMorPM.<dt><b>%r</b><dd>12-hour clock time [01-12] using the AM/PMnotation; in the POSIX locale, this will be equivalent to"%I:%M:%S %p".<dt><b>%S</b><dd>Seconds as a decimal number [00-61].<dt><b>%t</b><dd>Atabcharacter.<dt><b>%T</b><dd>24-hour clock time [00-23] in the format<i>HH:MM:SS .</i><dt><b>%u</b><dd>Weekday as a decimal number [1 (Monday)-7].<dt><b>%U</b><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 first Sunday are consideredto be in week 0.<dt><b>%V</b><dd>Week of the year (Monday as the first day of the week)as a decimal number [01-53].If the week containingJanuary 1 has four or more days in the new year, then it is considered week 1;otherwise, it is the last week of the previous year, and thenext week is week 1.<dt><b>%w</b><dd>Weekday as a decimal number [0 (Sunday)-6].<dt><b>%W</b><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 first Monday are consideredto be in week 0.<dt><b>%x</b><dd>Locale's appropriate date representation.<dt><b>%X</b><dd>Locale's appropriate time representation.<dt><b>%y</b><dd>Year within century [00-99].<dt><b>%Y</b><dd>Year with century as a decimal number.<dt><b>%Z</b><dd>Timezone name, or no characters if no timezone is determinable.<dt><b>%%</b><dd>A percent sign character.</dl><p>See the LC_TIME description inthe <b>XBD</b> specification, <a href="../xbd/locale.html"><b>Locale</b>&nbsp;</a> for the field descriptor values in the POSIX locale.<h5><a name = "tag_001_014_343_002">&nbsp;</a>Modified Field Descriptors</h5>Some field descriptors can be modified by theEandOmodifiercharacters to indicate a different format or specification asspecified in the LC_TIME locale description (seethe <b>XBD</b> specification, <a href="../xbd/locale.html"><b>Locale</b>&nbsp;</a> ).If the corresponding keyword (see<b>era</b>,<b>era_year</b>,<b>era_d_fmt</b>and<b>alt_digits</b>inthe <b>XBD</b> specification, <a href="../xbd/locale.html"><b>Locale</b>&nbsp;</a> )is not specified or not supported forthe current locale, the unmodified field descriptor value will be used.<dl compact><dt><b>%Ec</b><dd>Locale's alternative appropriate date and time representation.<dt><b>%EC</b><dd>The name of the base year (period) in the locale's alternative representation.<dt><b>%Ex</b><dd>Locale's alternative date representation.<dt>%EX<dd>Locale's alternative time representation.<dt><b>%Ey</b><dd>Offset from<b>%EC</b>(year only) in the locale's alternative representation.<dt><b>%EY</b><dd>Full alternative year representation.<dt><b>%Od</b><dd>Day of month using the locale's alternative numeric symbols.<dt><b>%Oe</b><dd>Day of month using the locale's alternative numeric symbols.<dt><b>%OH</b><dd>Hour (24-hour clock) using the locale's alternative numeric symbols.<dt><b>%OI</b><dd>Hour (12-hour clock) using the locale's alternative numeric symbols.<dt><b>%Om</b><dd>Month using the locale's alternative numeric symbols.<dt><b>%OM</b><dd>Minutes using the locale's alternative numeric symbols.<dt><b>%OS</b><dd>Seconds using the locale's alternative numeric symbols.<dt><b>%Ou</b><dd>Weekday as a number in the locale's alternative representation (Monday = 1).<dt><b>%OU</b><dd>Week number of the year (Sunday as the first day of theweek) using the locale's alternative numeric symbols.<dt><b>%OV</b><dd>Week number of the year (Monday as the first day of theweek, rules corresponding to<b>%V</b>),using the locale's alternative numeric symbols.<dt><b>%Ow</b><dd>Weekday as a number in the locale's alternative representation (Sunday = 0).<dt><b>%OW</b><dd>Week number of the year (Monday as the first day of theweek) using the locale's alternative numeric symbols.<dt><b>%Oy</b><dd>Year (offset from<b>%C</b>)in alternative representation.</dl><p><li><i>mmddhhmm</i><b>[[</b><i>cc</i><b>]</b><i>yy</i><b>]</b><br>Attempt to set the system date and timefrom the value given in the operand.This is only possible if the user has appropriate privileges andthe system permits the setting of the system date and time.The first<i>mm</i>is the month (number);<i>dd</i>is the 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 the century and is the first two digits of the year (this isoptional);<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] refer to years in the twentieth century(1969 to 1999 inclusive), and values in the range [00-68] refer toyears in the twenty-first century (2000 to 2068 inclusive).<p></></blockquote><h4><a name = "tag_001_014_344">&nbsp;</a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_345">&nbsp;</a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_346">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>date</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data as

⌨️ 快捷键说明

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