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