PDF 文書ファイルをダウンロードする (7229 KB)
date(1)Name | Synopsis | Description | Options | Operands | Examples | Environment Variables | Exit Status | Attributes | See Also | Diagnostics | Notes Name
Synopsis/usr/bin/date [-u] [+format] /usr/bin/date [-a [-]sss.fff] /usr/bin/date [-u] [ [mmdd] HHMM | mmddHHMM [cc] yy] [.SS] /usr/xpg4/bin/date [-u] [+format] /usr/xpg4/bin/date [-a [-]sss.fff]
/usr/xpg4/bin/date [-u]
[ [mmdd] HHMM | mmddHHMM [cc] yy] [.SS]
DescriptionThe date utility writes the date and time to standard output or attempts to set the system date and time. By default, the current date and time is written. Specifications of native language translations of month and weekday names are supported. The month and weekday names used for a language are based on the locale specified by the environment variable LC_TIME. See environ(5). The following is the default form for the "C" locale: %a %b %e %T %Z %Y For example,
Options
The following options are supported: Operands
The following operands are supported: The month, day, year number, and century may be omitted; the current values are applied as defaults. For example, the following entry:
sets the date to Oct 8, 12:45 a.m. The current year is the default because no year is supplied. The system operates in GMT. date takes care of the conversion to and from local standard and daylight time. Only the super-user may change the date. After successfully setting the date and time, date displays the new date according to the default format. The date command uses TZ to determine the correct time zone information; see environ(5). ExamplesExample 1 Generating OutputThe following command:
generates as output
Example 2 Setting the Current TimeThe following command sets the current time to 12:34:56:
Example 3 Setting Another Time and Date in Greenwich Mean TimeThe following command sets the date to January 1st, 12:30 am, 2000:
This is displayed as:
Environment Variables
See environ(5) for descriptions of the following environment variables that affect the execution of date: LANG, LC_ALL, LC_CTYPE, LC_TIME, LC_MESSAGES, and NLSPATH. Exit StatusAttributesSee attributes(5) for descriptions of the following attributes: /usr/bin/date/usr/xpg4/bin/dateSee AlsoDiagnostics
NotesIf you attempt to set the current date to one of the dates that the standard and alternate time zones change (for example, the date that daylight time is starting or ending), and you attempt to set the time to a time in the interval between the end of standard time and the beginning of the alternate time (or the end of the alternate time and the beginning of standard time), the results are unpredictable. Using the date command from within windowing environments to change the date can lead to unpredictable results and is unsafe. It can also be unsafe in the multi-user mode, that is, outside of a windowing system, if the date is changed rapidly back and forth. The recommended method of changing the date is 'date -a'. Setting the system time or allowing the system time to progress beyond 03:14:07 UTC Jan 19, 2038 is not supported on Solaris. Name | Synopsis | Description | Options | Operands | Examples | Environment Variables | Exit Status | Attributes | See Also | Diagnostics | Notes |
||||||||