4.3BSD-UWisc/man/man1/date.1

Compare this file to the similar file:
Show the results in this format:

.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)date.1	6.4 (Berkeley) 5/18/86
.\"
.TH DATE 1 "May 18, 1986"
.UC 4
.SH NAME
date \- print and set the date
.SH SYNOPSIS
.B date
.RB "[ -n ] [ -u ] [ yymmddhhmm [ " . "ss ] [ +format ] ]"
.SH 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
.I -u
flag is used to display or set the date in GMT (universal) time.
.I yy
represents the last two digits of the year;
the first
.I mm
is the month number;
.I dd
is the day number;
.I hh
is the hour number (24 hour system);
the second
.I mm
is the minute number;
.BI . ss
is optional and represents the seconds.
For example:
.IP
date 8506131627
.PP
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.
.I Date
takes care of the conversion to and from
local standard and daylight-saving time.
.PP
If 
.I timed(8)
is running to synchronize the clocks of machines in a local
area network, \fIdate\fP sets the time globally on all those
machines unless the
.B \-n
option is given.
.PP
If the argument begins with \fB+\fP,
the output of
.I date\^
is under the control of the user.
The format for the output is similar to that of
the first argument to
.IR printf (3S).
All output fields are of fixed size (zero padded
if necessary).
Each field descriptor is preceded by \fB%\fP
and will be replaced in the output by
its corresponding value.
A single \fB%\fP is encoded by \fB%%\fP.
All other
characters are copied to the output without change.
The string is always terminated with a new-line character.
.PP
Field Descriptors:
.RS
.PD 0
.TP 5
.B  n
insert a new-line character
.TP 5
.B  t
insert a tab character
.TP 5
.B  m
month of year \- 01 to 12
.TP 5
.B  d
day of month \- 01 to 31
.TP 5
.B  y
last 2 digits of year \- 00 to 99
.TP 5
.B D
date as mm/dd/yy
.TP 5
.B  H
hour \- 00 to 23
.TP 5
.B  M
minute \- 00 to 59
.TP 5
.B  S
second \- 00 to 59
.TP 5
.B T
time as \s-1HH:MM:SS\s+1
.TP 5
.B  j
day of year \- 001 to 366
.TP 5
.B  w
day of week \- Sunday = 0
.TP 5
.B  a
abbreviated weekday \- Sun to Sat
.TP 5
.B  h
abbreviated month \- Jan to Dec
.TP 5
.B  r
time in
.SM AM/PM
notation
.TP 5
.B  R
month of year in Roman
.RE
.ne 8
.SH EXAMPLE
.RS
date\| \(fm+DATE: %m/%d/%y%nTIME: %H:%M:%S\(fm
.RE
.PP
would have generated as output:
.PP
.RS
DATE: 08/01/76
.br
TIME: 14:45:05
.RE
.SH FILES
/usr/adm/wtmp to record time-setting.
In /usr/adm/messages, \fIdate\fP records the name of the user
setting the time.
.SH SEE ALSO
gettimeofday(2), utmp(5), timed(8),
.br
\fITSP: The Time Synchronization Protocol for UNIX 4.3BSD\fP, 
R. Gusella and S. Zatti
.SH 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.
.PP
`You are not superuser: date not set' if you try to change the date
but are not the super-user.
Occasionally, when \fItimed\fP synchronizes the time on many hosts, 
the setting of a new time value may require more than a few seconds.
On these occasions, \fIdate\fP prints: `Network time being set'.
The message `Communication error with timed' occurs when the communication
between \fIdate\fP and \fItimed\fP fails.
.SH "LOCAL MODS"
Added the "+format" option.
.SH 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.