1DATE(1) 386BSD Reference Manual DATE(1) 2 3NNAAMMEE 4 ddaattee - Display or set date and time 5 6SSYYNNOOPPSSIISS 7 ddaattee [--dd _d_s_t] [--rr _s_e_c_o_n_d_s] [--tt _m_i_n_u_t_e_s__w_e_s_t] [--nnuu] [++_f_o_r_m_a_t] 8 [[[[[[CC]YY]MM]DD]HH]MM[.ss]] 9 10DDEESSCCRRIIPPTTIIOONN 11 DDaattee displays the current date and time when invoked without arguments. 12 Providing arguments will format the date and time in a user-defined way 13 or set the date. Only the superuser may set the date. 14 15 The options are as follows: 16 17 --dd Set the kernel's values for daylight savings time. If _d_s_t is 18 non-zero, future calls to gettimeofday(2) will return a non-zero 19 `tz_dsttime'. 20 21 --nn The utility timed(8) is used to synchronize the clocks of groups 22 of machines. By default, if timed is running, ddaattee will set the 23 time on all of the machines in the local group. The --nn option 24 stops ddaattee from setting the time for other than the current 25 machine. 26 27 --rr Print out the date and time for _s_e_c_o_n_d_s from the Epoch. 28 29 --tt Set the kernel's values for minutes west of GMT. _M_i_n_u_t_e_s__w_e_s_t 30 specifies the number of minutes returned in `tz_minuteswest' by 31 future calls to gettimeofday(2). 32 33 --uu Display or set the date in UCT (universal) time. 34 35 An operand with a leading plus (``+'') sign signals a user-defined format 36 string which specifies the format in which to display the date and time. 37 The format string may contain any of the conversion specifications 38 described in the strftime(3) manual page, as well as any arbitrary text. 39 The format string for the default display is: 40 41 ``%a %b %e %H:%M:%S %Z %Y%n''. 42 43 If an operand does not have a leading plus sign, it is interpreted as a 44 value for setting the system's notion of the current date and time. The 45 canonical representation for setting the date and time: 46 47 _c_c Century in abbreviated form (.e.g 19 for 1989). 48 _y_y Year in abbreviated form (.e.g 89 for 1989). 49 _m_m Numeric month. A number from 1 to 12. 50 _d_d Day, a number from 1 to 31. 51 _h_h Hour, a number from 0 to 23. 52 _m_m Minutes, a number from 0 to 59. 53 ._s_s Seconds, a number from 0 to 59. 54 55 Everything but the minutes are optional. 56 57 Time changes for Daylight Saving and Standard time and leap seconds and 58 years are handled automatically. 59 60EEXXAAMMPPLLEESS 61 The command: 62 63 date ``+DATE: %m/%d/%y%nTIME: %H:%M:%n'' 64 65 66 will display: 67 68 DATE: 11/21/87 69 TIME: 13:36:16 70 71 The command: 72 73 date 8506131627 74 75 sets the date to ``June 13 1985, 4:27 PM''. 76 77 The command: 78 79 date 1432 80 81 sets the time to 2:32 PM, without modifying the date. 82 83FFIILLEESS 84 /var/log/wtmp A record of date resets and time changes. 85 /var/log/messages A record of the user setting the time. 86 87SSEEEE AALLSSOO 88 gettimeofday(2), strftime(3), utmp(5), timed(8) 89 90 R. Gusella, and S. Zatti, _T_S_P: _T_h_e _T_i_m_e _S_y_n_c_h_r_o_n_i_z_a_t_i_o_n _P_r_o_t_o_c_o_l _f_o_r _U_N_I_X 91 _4._3_B_S_D. 92 93DDIIAAGGNNOOSSTTIICCSS 94 Exit status is 0 on success, 1 if unable to set the date, and 2 if able 95 to set the local date but failing to set it globally. 96 97 Occasionally, when timed synchronizes the time on many hosts, the setting 98 of a new time value may require more than a few seconds. On these 99 occasions, ddaattee prints: `Network time being set'. The message 100 `Communication error with timed' occurs when the communication between 101 ddaattee and timed fails. 102 103BBUUGGSS 104 386BSD internally uses an absolute form of universal time, which is 105 converted back into local time when displayed. Since the computers 106 hardware clock records local time, and it is used to derive the initial 107 time at boot, it is imperitive that the rules for converting local time 108 be correctly configured for time to be properly set by the system. Also, 109 any drift in either the battery-powered real time clock (N.B. some of 110 these radically increase in speed as the battery dies), or the 111 rescheduling clock (in cheap clones, sometimes they don't even have 112 crystal clocks!) may result in inaccurate time. Use of network time and 113 the timed(8) daemon may provide a more reliable source of time. 114 115HHIISSTTOORRYY 116 The ddaattee command is expected to be compatible with IEEE Std1003.2 117 (``POSIX''). 118 119BSD Experimental July 30, 1991 2 120 121 122 123 124 125 126 127 128 129 130 131 132 133