update of arg processing; special problem diff
[unix-history] / usr / src / bin / date / date.1
CommitLineData
fd0821e6
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
86f03794 5.\" @(#)date.1 6.5 (Berkeley) %G%
fd0821e6 6.\"
842cd991 7.TH DATE 1 ""
fd0821e6
KM
8.UC 4
9.SH NAME
10date \- print and set the date
11.SH SYNOPSIS
12.B date
86f03794 13.RB "[-nu] [-d dst] [-t timezone] [yymmddhhmm [" . "ss] ]"
fd0821e6 14.SH DESCRIPTION
e0f82482 15If no arguments are given, the current date and time are printed.
86f03794
KB
16Providing an argument will set the desired date; only the superuser
17can set the date. The \fI-d\fP and \fI-t\fP flags set the kernel's
18values for daylight savings time and minutes west of GMT. If \fIdst\fP
19is non-zero, future calls to \fIgettimeofday\fP(2) will return a non-zero
20\fItz_dsttime\fP. \fITimezone\fP provides the number of minutes returned
21by future calls to \fIgettimeofday\fP(2) in \fItz_minuteswest\fP. The
22\fI-u\fP flag is used to display or set the date in GMT (universal) time.
fd0821e6 23.I yy
3ceb636f 24represents the last two digits of the year;
fd0821e6
KM
25the first
26.I mm
27is the month number;
28.I dd
3ceb636f 29is the day number;
fd0821e6
KM
30.I hh
31is the hour number (24 hour system);
32the second
33.I mm
34is the minute number;
35.BI . ss
3ceb636f 36is optional and represents the seconds.
fd0821e6
KM
37For example:
38.IP
3ceb636f 39date 8506131627
fd0821e6 40.PP
86f03794
KB
41sets the date to June 13 1985, 4:27 PM. The year, month and day may
42be omitted; the default values will be the current ones. The system
43operates in GMT. \fIDate\fP takes care of the conversion to and from
3ceb636f
RG
44local standard and daylight-saving time.
45.PP
46If
47.I timed(8)
48is running to synchronize the clocks of machines in a local
49area network, \fIdate\fP sets the time globally on all those
ae320a28
MK
50machines unless the
51.B \-n
52option is given.
fd0821e6 53.SH FILES
3ceb636f
RG
54/usr/adm/wtmp to record time-setting.
55In /usr/adm/messages, \fIdate\fP records the name of the user
56setting the time.
fd0821e6 57.SH SEE ALSO
3ceb636f
RG
58gettimeofday(2), utmp(5), timed(8),
59.br
60\fITSP: The Time Synchronization Protocol for UNIX 4.3BSD\fP,
61R. Gusella and S. Zatti
fd0821e6 62.SH DIAGNOSTICS
9e59c384
JL
63Exit status is 0 on success, 1 on complete failure to set the date,
64and 2 on successfully setting the local date but failing globally.
65.PP
3ceb636f
RG
66Occasionally, when \fItimed\fP synchronizes the time on many hosts,
67the setting of a new time value may require more than a few seconds.
68On these occasions, \fIdate\fP prints: `Network time being set'.
69The message `Communication error with timed' occurs when the communication
70between \fIdate\fP and \fItimed\fP fails.
fd0821e6
KM
71.SH BUGS
72The system attempts to keep the date in a format closely compatible
73with VMS. VMS, however, uses local time (rather than GMT) and does
3ceb636f 74not understand daylight-saving time. Thus, if you use both UNIX
fd0821e6 75and VMS, VMS will be running on GMT.