1 .\" $NetBSD: date.1,v 1.38 2006/11/26 16:40:44 wiz Exp $
3 .\" Copyright (c) 1980, 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)date.1 8.3 (Berkeley) 4/28/95
40 .Nd display or set date and time
58 displays the current date and time when invoked without arguments.
59 Providing arguments will format the date and time in a user-defined
61 Only the superuser may set the date.
63 The options are as follows:
68 to change the local system time slowly,
69 maintaining it as a monotonically increasing function.
74 Parse the provided human-described date and time and display the result without
75 actually changing the system clock.
77 Parse the provided canonical representation of date and time (described below)
78 and display the result without actually changing the system clock.
82 is used to synchronize the clocks on groups of machines.
87 will set the time on all of the machines in the local group.
92 from setting the time for other than the current machine.
94 Print out the date and time that is
98 Display or set the date in
103 An operand with a leading plus
105 sign signals a user-defined format
106 string which specifies the format in which to display the date and time.
107 The format string may contain any of the conversion specifications described
110 manual page, as well as any arbitrary text.
111 A \*[Lt]newline\*[Gt] character is always output after the characters
112 specified by the format string.
113 The format string for the default display is:
114 .Bd -literal -offset indent
115 %a %b %e %H:%M:%S %Z %Y
118 If an operand does not have a leading plus sign, it is interpreted as
119 a value for setting the system's notion of the current date and time.
120 The canonical representation for setting the date and time is:
122 .Bl -tag -width Ds -compact -offset indent
124 The first two digits of the year (the century).
126 The second two digits of the year.
133 between 69 and 99 results in a
140 The month of the year, from 01 to 12.
142 The day of the month, from 01 to 31.
144 The hour of the day, from 00 to 23.
146 The minute of the hour, from 00 to 59.
148 The second of the minute, from 00 to 61.
151 Everything but the minutes is optional.
153 Time changes for Daylight Saving and Standard time and leap seconds
154 and years are handled automatically.
156 The following environment variables affect the execution of
160 The timezone to use when displaying dates.
163 for more information.
166 .Bl -tag -width /var/log/messages -compact
167 .It Pa /etc/localtime
168 Symlink pointing to system's default timezone information file in
169 .Pa /usr/share/zoneinfo
172 A record of date resets and time changes.
173 .It Pa /var/log/messages
174 A record of the user setting the time.
178 .Bd -literal -offset indent
179 date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'
183 .Bd -literal -offset indent
189 .Bd -literal -offset indent
194 .Dq Li "June 13, 1985, 4:27 PM" .
197 .Bd -literal -offset indent
203 without modifying the date.
205 Exit status is 0 on success, 1 if unable to set the date, and 2
206 if able to set the local date, but unable to set it globally.
210 synchronizes the time on many hosts, the setting of a new time value may
211 require more than a few seconds.
215 .Ql Network time being set .
217 .Ql Communication error with timed
218 occurs when the communication
233 .%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
240 utility is expected to be compatible with