Commit | Line | Data |
---|---|---|
b5dc1377 CL |
1 | .\" Copyright (c) 1980, 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" %sccs.include.redist.man% | |
5 | .\" | |
912d0f8e | 6 | .\" @(#)date.1 6.11 (Berkeley) %G% |
b5dc1377 CL |
7 | .\" |
8 | .Dd | |
b5dc1377 | 9 | .Dt DATE 1 |
5325ced3 | 10 | .Os BSD 4.4 |
b5dc1377 CL |
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 | |
407e753d KB |
19 | .Op +format |
20 | .Op [yy[mm[dd[hh]]]]mm[\&.ss] | |
b5dc1377 CL |
21 | .Sh DESCRIPTION |
22 | .Nm Date | |
407e753d KB |
23 | displays the current date and time when invoked without arguments. |
24 | Providing arguments will format the date and time in a user-defined | |
25 | way or set the date. | |
26 | Only the superuser may set the date. | |
5325ced3 CL |
27 | .Pp |
28 | Options are: | |
29 | .Pp | |
30 | .Tw Ds | |
b5dc1377 CL |
31 | .Tp Fl d |
32 | Set the kernel's values for daylight savings time. | |
33 | If | |
34 | .Ar dst | |
35 | is non-zero, future calls | |
36 | to | |
5325ced3 CL |
37 | .Xr gettimeofday 2 |
38 | will return a non-zero | |
39 | .Ql tz_dsttime . | |
407e753d KB |
40 | .Tp Fl n |
41 | The utility | |
42 | .Xr timed 8 | |
43 | is used to synchronize the clocks of groups of machines. | |
44 | By default, if | |
45 | .Xr timed | |
46 | is running, | |
47 | .Nm date | |
48 | will set the time on all of the machines in the local group. | |
49 | The | |
50 | .Fl n | |
51 | option stops | |
52 | .Nm date | |
53 | from setting the time for other than the current machine. | |
b5dc1377 CL |
54 | .Tp Fl t |
55 | Set the kernel's values for minutes west of GMT. | |
56 | .Ar Minutes_west | |
407e753d KB |
57 | specifies the number of minutes returned in |
58 | .Ql tz_minuteswest | |
59 | by future calls to | |
60 | .Xr gettimeofday 2 . | |
b5dc1377 | 61 | .Tp Fl u |
407e753d | 62 | Display or set the date in UCT (universal) time. |
b5dc1377 CL |
63 | .Tp |
64 | .Pp | |
407e753d KB |
65 | An operand with a leading plus (``+'') sign signals a user-defined format |
66 | string which specifies the format in which to display the date and time. | |
67 | The format string may contain any of the conversion specifications described | |
68 | in the | |
69 | .Xr strftime 3 | |
70 | manual page, as well as any arbitrary text. | |
71 | The format string for the default display is: | |
72 | .Pp | |
73 | .Dl ``%a %b %e %H:%M:%S %Z %Y\en''. | |
74 | .Pp | |
75 | If an operand does not have a leading plus sign, it is interpreted as | |
76 | a value for setting the system's notion of the current date and time. | |
b5dc1377 | 77 | The canonical representation for setting the date and time: |
5325ced3 | 78 | .Dw Ds |
b5dc1377 CL |
79 | .Dp Ar yy |
80 | Year in abbreviated form (.e.g 89 for 1989). | |
81 | .Dp Ar mm | |
82 | Numeric month. | |
407e753d | 83 | A number from 1 to 12. |
b5dc1377 | 84 | .Dp Ar dd |
407e753d | 85 | Day, a number from 1 to 31. |
b5dc1377 | 86 | .Dp Ar hh |
f9eecd6d | 87 | Hour, a number from 0 to 23. |
b5dc1377 | 88 | .Dp Ar mm |
f9eecd6d | 89 | Minutes, a number from 0 to 59. |
b5dc1377 | 90 | .Dp Ar .ss |
407e753d | 91 | Seconds, a number from 0 to 60. |
b5dc1377 | 92 | .Dp |
407e753d KB |
93 | .Pp |
94 | Everything but the minutes are optional. | |
95 | .Pp | |
96 | Time changes for Daylight Saving and Standard time and leap seconds | |
97 | and years are handled automatically. | |
98 | .Sh EXAMPLES | |
99 | The command: | |
100 | .Pp | |
912d0f8e | 101 | .Dl date ``+DATE: %m/%d/%y%nTIME: %H:%M:n'' |
407e753d KB |
102 | .Pp |
103 | will display: | |
104 | .Pp | |
105 | .Dl DATE: 11/21/87 | |
106 | .Dl TIME: 13:36:16 | |
107 | .Pp | |
b5dc1377 CL |
108 | The command: |
109 | .Pp | |
110 | .Dl date 8506131627 | |
111 | .Pp | |
112 | sets the date to June 13 1985, 4:27 PM. | |
113 | .Pp | |
407e753d | 114 | The command: |
b5dc1377 CL |
115 | .Pp |
116 | .Dl date 1432 | |
117 | .Pp | |
407e753d | 118 | sets the time to 2:32 PM, without modifying the date. |
b5dc1377 | 119 | .Sh FILES |
5325ced3 | 120 | .Dw /var/log/messages |
b5dc1377 | 121 | .Di L |
5325ced3 | 122 | .Dp Pa /var/log/wtmp |
b5dc1377 | 123 | A record of date resets and time changes. |
5325ced3 | 124 | .Dp Pa /var/log/messages |
407e753d | 125 | A record of the user setting the time. |
b5dc1377 CL |
126 | .Sh SEE ALSO |
127 | .Xr gettimeofday 2 , | |
407e753d | 128 | .Xr strftime 3 , |
b5dc1377 | 129 | .Xr utmp 5 , |
5325ced3 | 130 | .Xr timed 8 |
3ceb636f | 131 | .br |
b5dc1377 CL |
132 | .Em TSP:\ The\ Time\ Synchronization Protocol |
133 | .Em for UNIX 4.3BSD , | |
134 | R. Gusella | |
135 | and\ S.\ Zatti | |
136 | .Sh HISTORY | |
5325ced3 | 137 | .Nm Date |
b5dc1377 CL |
138 | appeared in Version 6 AT&T UNIX. |
139 | .Sh DIAGNOSTICS | |
407e753d KB |
140 | Exit status is 0 on success, 1 on if unable to set the date, and 2 on |
141 | if able to set the local date but failing to set it globally. | |
b5dc1377 CL |
142 | .Pp |
143 | Occasionally, when | |
5325ced3 | 144 | .Xr timed |
407e753d KB |
145 | synchronizes the time on many hosts, the setting of a new time value may |
146 | require more than a few seconds. | |
b5dc1377 CL |
147 | On these occasions, |
148 | .Nm date | |
149 | prints: `Network time being set'. | |
3ceb636f | 150 | The message `Communication error with timed' occurs when the communication |
b5dc1377 CL |
151 | between |
152 | .Nm date | |
153 | and | |
5325ced3 | 154 | .Xr timed |
b5dc1377 CL |
155 | fails. |
156 | .Sh BUGS | |
fd0821e6 | 157 | The system attempts to keep the date in a format closely compatible |
407e753d KB |
158 | with VMS. |
159 | VMS, however, uses local time (rather than GMT) and does not understand | |
160 | daylight-saving time. | |
161 | Thus, if you use both UNIX and VMS, VMS will be running on GMT. |