DATE(1) BSD Reference Manual DATE(1)
d
\bda
\bat
\bte
\be - display or set date and time
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
d
\bda
\bat
\bte
\be [-
\b-d
\bd _
\bd_
\bs_
\bt] [-
\b-r
\br _
\bs_
\be_
\bc_
\bo_
\bn_
\bd_
\bs] [-
\b-t
\bt _
\bm_
\bi_
\bn_
\bu_
\bt_
\be_
\bs_
\b__
\bw_
\be_
\bs_
\bt] [-
\b-n
\bnu
\bu] [+
\b+_
\bf_
\bo_
\br_
\bm_
\ba_
\bt]
[[yy[mm[dd[hh]]]]mm[.ss]]
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
D
\bDa
\bat
\bte
\be displays the current date and time when invoked without arguments.
Providing arguments will format the date and time in a user-defined way
or set the date. Only the superuser may set the date.
The options are as follows:
-
\b-d
\bd Set the kernel's value for daylight savings time. If _
\bd_
\bs_
\bt is non-
zero, future calls to gettimeofday(2) will return a non-zero
-
\b-n
\bn The utility timed(8) is used to synchronize the clocks on groups
of machines. By default, if timed is running, d
\bda
\bat
\bte
\be will set the
time on all of the machines in the local group. The -
\b-n
\bn option
stops d
\bda
\bat
\bte
\be from setting the time for other than the current ma-
-
\b-r
\br Print out the date and time in _
\bs_
\be_
\bc_
\bo_
\bn_
\bd_
\bs from the Epoch.
-
\b-t
\bt Set the kernel's value for minutes west of GMT. _
\bM_
\bi_
\bn_
\bu_
\bt_
\be_
\bs_
\b__
\bw_
\be_
\bs_
\bt
specifies the number of minutes returned in `tz_minuteswest' by
future calls to gettimeofday(2).
-
\b-u
\bu Display or set the date in UCT (universal) time.
An operand with a leading plus (``+'') sign signals a user-defined format
string which specifies the format in which to display the date and time.
The format string may contain any of the conversion specifications de-
scribed in the strftime(3) manual page, as well as any arbitrary text. A
<newline> character is always output after the characters specified by
the format string. The format string for the default display is:
``%a %b %e %H:%M:%S %Z %Y''.
If an operand does not have a leading plus sign, it is interpreted as a
value for setting the system's notion of the current date and time. The
canonical representation for setting the date and time is:
_
\by_
\by Year in abbreviated form (.e.g 89 for 1989).
_
\bm_
\bm Numeric month. A number from 1 to 12.
_
\bd_
\bd Day, a number from 1 to 31.
_
\bh_
\bh Hour, a number from 0 to 23.
_
\bm_
\bm Minutes, a number from 0 to 59.
_
\b._
\bs_
\bs Seconds, a number from 0 to 61 (59 plus a a maximum of two
Everything but the minutes is optional.
Time changes for Daylight Saving and Standard time and leap seconds and
years are handled automatically.
E
\bEX
\bXA
\bAM
\bMP
\bPL
\bLE
\bES
\bS
date ``+DATE: %m/%d/%y%nTIME: %H:%M:%S''
sets the date to ``June 13, 1985, 4:27 PM''.
sets the time to 2:32 PM, without modifying the date.
E
\bEN
\bNV
\bVI
\bIR
\bRO
\bON
\bNM
\bME
\bEN
\bNT
\bTA
\bAL
\bL V
\bVA
\bAR
\bRI
\bIA
\bAB
\bBL
\bLE
\bES
\bS
The following environment variables affect the execution of d
\bda
\bat
\bte
\be:
The timezone to use when displaying dates. See environ(7) for more in-
/var/log/wtmp A record of date resets and time changes.
/var/log/messages A record of the user setting the time.
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
gettimeofday(2), strftime(3), utmp(5), timed(8)
R. Gusella, and S. Zatti, _
\bT_
\bS_
\bP_
\b: _
\bT_
\bh_
\be _
\bT_
\bi_
\bm_
\be _
\bS_
\by_
\bn_
\bc_
\bh_
\br_
\bo_
\bn_
\bi_
\bz_
\ba_
\bt_
\bi_
\bo_
\bn _
\bP_
\br_
\bo_
\bt_
\bo_
\bc_
\bo_
\bl _
\bf_
\bo_
\br _
\bU_
\bN_
\bI_
\bX
_
\b4_
\b._
\b3_
\bB_
\bS_
\bD.
D
\bDI
\bIA
\bAG
\bGN
\bNO
\bOS
\bST
\bTI
\bIC
\bCS
\bS
Exit status is 0 on success, 1 if unable to set the date, and 2 if able
to set the local date, but unable to set it globally.
Occasionally, when timed synchronizes the time on many hosts, the setting
of a new time value may require more than a few seconds. On these occa-
sions, d
\bda
\bat
\bte
\be prints: `Network time being set'. The message `Communication
error with timed' occurs when the communication between d
\bda
\bat
\bte
\be and timed
The system attempts to keep the date in a format closely compatible with
VMS. VMS, however, uses local time (rather than GMT) and does not under-
stand daylight-savings time. Thus, if you use both UNIX and VMS, VMS
S
\bST
\bTA
\bAN
\bND
\bDA
\bAR
\bRD
\bDS
\bS
The d
\bda
\bat
\bte
\be command is expected to be compatible with IEEE Std1003.2