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