date.1 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. .TH DATE 1
  2. .SH NAME
  3. date \- show and set date and time
  4. .SH SYNOPSIS
  5. .if n .nh
  6. .if n .na
  7. .B date
  8. [
  9. .B \-u
  10. ] [
  11. .B \-c
  12. ] [
  13. .B \-n
  14. ] [
  15. .B \-d
  16. dsttype
  17. ] [
  18. .B \-t
  19. minutes-west
  20. ] [
  21. \fB\-a \fR[\fB+\fR|\fB-]\fIsss\fB.\fIfff\fR
  22. ] [
  23. .BI + format
  24. ] [
  25. \fR[\fIyyyy\fR]\fImmddhhmm\fR[\fIyy\fR][\fB.\fIss\fR]
  26. ]
  27. .SH DESCRIPTION
  28. .I Date
  29. without arguments writes the date and time to the standard output in
  30. the form
  31. .ce 1
  32. Wed Mar 8 14:54:40 EST 1989
  33. .br
  34. with
  35. .B EST
  36. replaced by the local time zone's abbreviation
  37. (or by the abbreviation for the time zone specified in the
  38. .B TZ
  39. environment variable if set).
  40. The exact output format depends on the locale.
  41. .PP
  42. If a command-line argument starts with a plus sign
  43. .RB (` + '),
  44. the rest of the argument is used as a
  45. .I format
  46. that controls what appears in the output.
  47. In the format, when a percent sign
  48. .RB (` % ')
  49. appears,
  50. it and the character after it are not output,
  51. but rather identify part of the date or time
  52. to be output in a particular way
  53. (or identify a special character to output):
  54. .nf
  55. .sp
  56. .if t .in +.5i
  57. .if n .in +2
  58. .ta \w'%M\0\0'u +\w'Wed Mar 8 14:54:40 EST 1989\0\0'u
  59. Sample output Explanation
  60. %a Wed Abbreviated weekday name*
  61. %A Wednesday Full weekday name*
  62. %b Mar Abbreviated month name*
  63. %B March Full month name*
  64. %c Wed Mar 08 14:54:40 1989 Date and time*
  65. %C 19 Century
  66. %d 08 Day of month (always two digits)
  67. %D 03/08/89 Month/day/year (eight characters)
  68. %e 8 Day of month (leading zero blanked)
  69. %h Mar Abbreviated month name*
  70. %H 14 24-hour-clock hour (two digits)
  71. %I 02 12-hour-clock hour (two digits)
  72. %j 067 Julian day number (three digits)
  73. %k 2 12-hour-clock hour (leading zero blanked)
  74. %l 14 24-hour-clock hour (leading zero blanked)
  75. %m 03 Month number (two digits)
  76. %M 54 Minute (two digits)
  77. %n \\n newline character
  78. %p PM AM/PM designation
  79. %r 02:54:40 PM Hour:minute:second AM/PM designation
  80. %R 14:54 Hour:minute
  81. %S 40 Second (two digits)
  82. %t \\t tab character
  83. %T 14:54:40 Hour:minute:second
  84. %U 10 Sunday-based week number (two digits)
  85. %w 3 Day number (one digit, Sunday is 0)
  86. %W 10 Monday-based week number (two digits)
  87. %x 03/08/89 Date*
  88. %X 14:54:40 Time*
  89. %y 89 Last two digits of year
  90. %Y 1989 Year in full
  91. %Z EST Time zone abbreviation
  92. %+ Wed Mar 8 14:54:40 EST 1989 Default output format*
  93. .if t .in -.5i
  94. .if n .in -2
  95. * The exact output depends on the locale.
  96. .sp
  97. .fi
  98. If a character other than one of those shown above appears after
  99. a percent sign in the format,
  100. that following character is output.
  101. All other characters in the format are copied unchanged to the output;
  102. a newline character is always added at the end of the output.
  103. .PP
  104. In Sunday-based week numbering,
  105. the first Sunday of the year begins week 1;
  106. days preceding it are part of ``week 0.''
  107. In Monday-based week numbering,
  108. the first Monday of the year begins week 1.
  109. .PP
  110. To set the date, use a command line argument with one of the following forms:
  111. .nf
  112. .if t .in +.5i
  113. .if n .in +2
  114. .ta \w'198903081454\0'u
  115. 1454 24-hour-clock hours (first two digits) and minutes
  116. 081454 Month day (first two digits), hours, and minutes
  117. 03081454 Month (two digits, January is 01), month day, hours, minutes
  118. 8903081454 Year, month, month day, hours, minutes
  119. 0308145489 Month, month day, hours, minutes, year
  120. (on System V-compatible systems)
  121. 030814541989 Month, month day, hours, minutes, four-digit year
  122. 198903081454 Four-digit year, month, month day, hours, minutes
  123. .if t .in -.5i
  124. .if n .in -2
  125. .fi
  126. If the century, year, month, or month day is not given,
  127. the current value is used.
  128. Any of the above forms may be followed by a period and two digits that give
  129. the seconds part of the new time; if no seconds are given, zero is assumed.
  130. .PP
  131. These options are available:
  132. .TP
  133. .BR \-u " or " \-c
  134. Use UTC when setting and showing the date and time.
  135. .TP
  136. .B \-n
  137. Do not notify other networked systems of the time change.
  138. .TP
  139. .BI "\-d " dsttype
  140. Set the kernel-stored Daylight Saving Time type to the given value.
  141. (The kernel-stored DST type is used mostly by ``old'' binaries.)
  142. .TP
  143. .BI "\-t " minutes-west
  144. Set the kernel-stored ``minutes west of UTC'' value to the one given on the
  145. command line.
  146. (The kernel-stored DST type is used mostly by ``old'' binaries.)
  147. .TP
  148. .BI "\-a " adjustment
  149. Change the time forward (or backward) by the number of seconds
  150. (and fractions thereof) specified in the
  151. .I adjustment\^
  152. argument.
  153. Either the seconds part or the fractions part of the argument (but not both)
  154. may be omitted.
  155. On BSD-based systems,
  156. the adjustment is made by changing the rate at which time advances;
  157. on System-V-based systems, the adjustment is made by changing the time.
  158. .SH FILES
  159. .ta \w'/usr/local/etc/zoneinfo/posixrules\0\0'u
  160. /usr/lib/locale/\f2L\fP/LC_TIME description of time locale \f2L\fP
  161. .br
  162. /usr/local/etc/zoneinfo time zone information directory
  163. .br
  164. /usr/local/etc/zoneinfo/localtime local time zone file
  165. .br
  166. /usr/local/etc/zoneinfo/posixrules used with POSIX-style TZ's
  167. .br
  168. /usr/local/etc/zoneinfo/GMT for UTC leap seconds
  169. .sp
  170. If
  171. .B /usr/local/etc/zoneinfo/GMT
  172. is absent,
  173. UTC leap seconds are loaded from
  174. .BR /usr/local/etc/zoneinfo/posixrules .
  175. .\" %W%
  176. .\" This file is in the public domain, so clarified as of
  177. .\" 2009-05-17 by Arthur David Olson.