xref: /original-bsd/bin/date/date.1 (revision 6b3572dd)
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)date.1	6.8 (Berkeley) 07/24/90
7.\"
8.Dd
9.Dt DATE 1
10.Os BSD 4.4
11.Sh NAME
12.Nm date
13.Nd display or set date and time
14.Sh SYNOPSIS
15.Nm date
16.Op Fl nu
17.Op Fl d Ar dst
18.Op Fl t Ar minutes_west
19.Op yymmddhhmm [\&.ss]
20.Sh DESCRIPTION
21.Nm Date
22displays today's date and time when invoked without
23arguments.  Providing an argument will set the desired date;
24only the superuser can set the date.
25.Pp
26Options are:
27.Pp
28.Tw Ds
29.Tp Fl d
30Set the kernel's values for daylight savings time.
31If
32.Ar dst
33is non-zero, future calls
34to
35.Xr gettimeofday 2
36will return a non-zero
37.Ql tz_dsttime  .
38.Tp Fl t
39Set the kernel's values for minutes west of GMT.
40.Ar Minutes_west
41provides the number of minutes returned by future calls to
42.Xr gettimeofday 2
43in
44.Ql tz_minuteswest  .
45.Tp Fl u
46Display or set the date in GMT (universal) time.
47.Tp
48.Pp
49The canonical representation for setting the date and time:
50.Dw Ds
51.Dp Ar yy
52Year in abbreviated form (.e.g 89 for 1989).
53.Dp Ar mm
54Numeric month.
55A number from 01 to 12.
56.Dp Ar dd
57Day, a number from 01 to 31.
58.Dp Ar hh
59Hour, a number from 00 to 24.
60.Dp Ar mm
61Minutes, a number from 00 to 60.
62.Dp Ar .ss
63Seconds, a number from 00 to 60.
64.Dp
65The command:
66.Pp
67.Dl date 8506131627
68.Pp
69sets the date to June 13 1985, 4:27 PM.
70.Pp
71To reset today's time, the incantation can be shortened
72to just the hours and minutes:
73.Pp
74.Dl date 1432
75.Pp
76sets the time to 2:32 PM, unaffecting the date.
77.Pp
78Providing a system stays running, date will handle
79time changes for daylight/standards savings time and leap times.
80.Pp
81If
82.Xr timed 8
83is running to synchronize the clocks of machines in a local
84area network,
85.Nm date
86sets the time globally on all those
87machines unless the
88.Fl n
89option is given.
90.Sh FILES
91.Dw /var/log/messages
92.Di L
93.Dp Pa /var/log/wtmp
94A record of date resets and time changes.
95.Dp Pa /var/log/messages
96A record of the name of the user
97setting the time.
98.Sh SEE ALSO
99.Xr gettimeofday 2 ,
100.Xr utmp 5 ,
101.Xr timed 8
102.br
103.Em TSP:\ The\ Time\ Synchronization Protocol
104.Em for UNIX 4.3BSD ,
105R. Gusella
106and\ S.\ Zatti
107.Sh HISTORY
108.Nm Date
109appeared in Version 6 AT&T UNIX.
110.Sh DIAGNOSTICS
111Exit status is 0 on success, 1 on complete failure to set the date,
112and 2 on successfully setting the local date but failing globally.
113.Pp
114Occasionally, when
115.Xr timed
116synchronizes the time on many hosts,
117the setting of a new time value may require more than a few seconds.
118On these occasions,
119.Nm date
120prints: `Network time being set'.
121The message `Communication error with timed' occurs when the communication
122between
123.Nm date
124and
125.Xr timed
126fails.
127.Sh BUGS
128The system attempts to keep the date in a format closely compatible
129with VMS.  VMS, however, uses local time (rather than GMT) and does
130not understand daylight-saving time.  Thus, if you use both UNIX
131and VMS, VMS will be running on GMT.
132