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