4.3BSD-UWisc/man/cat1/date.1
DATE(1) UNIX Programmer's Manual DATE(1)
NAME
date - print and set the date
SYNOPSIS
date [ -n ] [ -u ] [ yymmddhhmm [ .ss ] [ +format ] ]
DESCRIPTION
If no arguments are given, the current date and time are
printed. Providing an argument will set the desired date.
Only the superuser can set the date. The -_u flag is used to
display or set the date in GMT (universal) time. _y_y
represents the last two digits of the year; the first _m_m is
the month number; _d_d is the day number; _h_h is the hour
number (24 hour system); the second _m_m is the minute number;
._s_s is optional and represents the seconds. For example:
date 8506131627
sets the date to June 13 1985, 4:27 PM. The year, month and
day may be omitted; the default values will be the current
ones. The system operates in GMT. _D_a_t_e takes care of the
conversion to and from local standard and daylight-saving
time.
If _t_i_m_e_d(_8) is running to synchronize the clocks of machines
in a local area network, _d_a_t_e sets the time globally on all
those machines unless the -n option is given.
If the argument begins with +, the output of _d_a_t_e is under
the control of the user. The format for the output is simi-
lar to that of the first argument to _p_r_i_n_t_f(3S). All output
fields are of fixed size (zero padded if necessary). Each
field descriptor is preceded by % and will be replaced in
the output by its corresponding value. A single % is
encoded by %%. All other characters are copied to the out-
put without change. The string is always terminated with a
new-line character.
Field Descriptors:
n insert a new-line character
t insert a tab character
m month of year - 01 to 12
d day of month - 01 to 31
y last 2 digits of year - 00 to 99
D date as mm/dd/yy
H hour - 00 to 23
M minute - 00 to 59
S second - 00 to 59
T time as HH:MM:SS
j day of year - 001 to 366
w day of week - Sunday = 0
a abbreviated weekday - Sun to Sat
Printed 12/27/86 May 18, 1986 1
DATE(1) UNIX Programmer's Manual DATE(1)
h abbreviated month - Jan to Dec
r time in AM/PM notation
R month of year in Roman
EXAMPLE
date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'
would have generated as output:
DATE: 08/01/76
TIME: 14:45:05
FILES
/usr/adm/wtmp to record time-setting. In /usr/adm/messages,
_d_a_t_e records the name of the user setting the time.
SEE ALSO
gettimeofday(2), utmp(5), timed(8),
_T_S_P: _T_h_e _T_i_m_e _S_y_n_c_h_r_o_n_i_z_a_t_i_o_n _P_r_o_t_o_c_o_l _f_o_r _U_N_I_X _4._3_B_S_D, R.
Gusella and S. Zatti
DIAGNOSTICS
Exit status is 0 on success, 1 on complete failure to set
the date, and 2 on successfully setting the local date but
failing globally.
`You are not superuser: date not set' if you try to change
the date but are not the super-user. Occasionally, when
_t_i_m_e_d synchronizes the time on many hosts, the setting of a
new time value may require more than a few seconds. On
these occasions, _d_a_t_e prints: `Network time being set'. The
message `Communication error with timed' occurs when the
communication between _d_a_t_e and _t_i_m_e_d fails.
LOCAL MODS
Added the "+format" option.
BUGS
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 understand daylight-saving time.
Thus, if you use both UNIX and VMS, VMS will be running on
GMT.
Printed 12/27/86 May 18, 1986 2