.TH date "" "" Command
.PC "Print/set the date and time"
\fBdate [\-s] [\-u] [[\fIyymmdd\^\fB]\fIhhmm\^\fB[\fI.ss\^\fB]]\fR
.PP
.HS
.SH Options:
.IC \fB\-s\fR
Suppress daylight savings time conversion
.IC \fB\-u\fR
Print (and enter) date in Greenwich Mean Time
.HE
.B date
sets or prints prints the date and time of day.
.PP
If invoked without an argument,
.B date
prints the current date and time.
It looks for the environmental variable
.BR TIMEZONE ,
which specifies local time zone and daylight saving time information.
For details on the format of this variable, see the Lexicon entries for
.B TIMEZONE
and
.BR ctime() .
.PP
If invoked with a numeric argument (that is, one that consists of just
digits, with no prefix),
.B date
interprets that argument as giving the current date and time, and uses it
to set the current system time.
The string must have the format \fIyymmddhhmm\fB[\fIss\^\fB]\fR; the fields
must be defined as follows:
.DS
.ta 0.4i 1.0i
	\fIyy\fR	Year (00-99)
	\fImm\fR	Month (01-12)
	\fIdd\fR	Day (01-31)
	\fIhh\fR	Hour (00-23)
	\fImm\fR	Minute (00-59)
	\fIss\fR	Seconds (00-59)
.DE
.PP
For example, typing
.DM
	date 940612141233
.DE
.PP
sets the date to June 12, 1994, and the time to 2:12:33 P.M.
At least
.I hh
and
.I mm
must be specified \(em the
rest are optional.
.B date
will complain and refuse to change the time should you attempt to set an
impossible date or time, e.g., the date to February 30 or the time to 25
o'clock.
.PP
Note that the \*(CO command
.B ATclock
returns the date and time as recorded by your computer's internal clock.
To reset the time as \*(CO understands it to the time as your computer
understands it, use the command:
.DM
	date \(ga/etc/ATclock\(ga
.DE
.PP
If you use option
.B \-s
on
.BR date 's
command line,
.B date
does
.I not
convert to daylight savings time when it sets the time.
.PP
If you use option
.B \-u
on
.BR date 's
command line,
.B date
sets and prints the date and time in Greenwich Mean Time (GMT)
rather than in your local time.
.SH "See Also"
.Xr "ATclock," atclock
.Xr "commands," commands
.Xr "ctime()," ctime
.Xr "printf()," printf
.Xr "time," time
.Xr "TIMEZONE" timezone
.SH Notes
Only the superuser
.B root
can change the system's date or time.
.PP
The \*(CO version of the
.B date
command differs from the \*(UN version in that the last two fields of its
output are reversed.
For example, the \*(UN output of
.B date
reads
.DM
	Sun Jan 13 12:02:09 CST 1991
.DE
.PP
where the \*(CO output reads:
.DM
	Sun Jan 13 12:02:09 1991 CST
.DE
.PP
This may be important when importing \*(UN shell commands into \*(CO.
