date.1 4.6 KB

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