summaryrefslogtreecommitdiffstats
path: root/man/date.1
blob: ede6dfeec63829b7c8c8fe63eadccc26d75889d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.3.
.TH DATE "1" "March 2020" "GNU coreutils 8.32" "User Commands"
.SH NAME
date \- print or set the system date and time
.SH SYNOPSIS
.B date
[\fI\,OPTION\/\fR]... [\fI\,+FORMAT\/\fR]
.br
.B date
[\fI\,-u|--utc|--universal\/\fR] [\fI\,MMDDhhmm\/\fR[[\fI\,CC\/\fR]\fI\,YY\/\fR][\fI\,.ss\/\fR]]
.SH DESCRIPTION
.\" Add any additional description here
.PP
Display the current time in the given FORMAT, or set the system date.
.PP
Mandatory arguments to long options are mandatory for short options too.
.TP
\fB\-d\fR, \fB\-\-date\fR=\fI\,STRING\/\fR
display time described by STRING, not 'now'
.TP
\fB\-\-debug\fR
annotate the parsed date,
and warn about questionable usage to stderr
.TP
\fB\-f\fR, \fB\-\-file\fR=\fI\,DATEFILE\/\fR
like \fB\-\-date\fR; once for each line of DATEFILE
.TP
\fB\-I[FMT]\fR, \fB\-\-iso\-8601\fR[=\fI\,FMT\/\fR]
output date/time in ISO 8601 format.
FMT='date' for date only (the default),
\&'hours', 'minutes', 'seconds', or 'ns'
for date and time to the indicated precision.
Example: 2006\-08\-14T02:34:56\-06:00
.TP
\fB\-R\fR, \fB\-\-rfc\-email\fR
output date and time in RFC 5322 format.
Example: Mon, 14 Aug 2006 02:34:56 \fB\-0600\fR
.TP
\fB\-\-rfc\-3339\fR=\fI\,FMT\/\fR
output date/time in RFC 3339 format.
FMT='date', 'seconds', or 'ns'
for date and time to the indicated precision.
Example: 2006\-08\-14 02:34:56\-06:00
.TP
\fB\-r\fR, \fB\-\-reference\fR=\fI\,FILE\/\fR
display the last modification time of FILE
.TP
\fB\-s\fR, \fB\-\-set\fR=\fI\,STRING\/\fR
set time described by STRING
.TP
\fB\-u\fR, \fB\-\-utc\fR, \fB\-\-universal\fR
print or set Coordinated Universal Time (UTC)
.TP
\fB\-\-help\fR
display this help and exit
.TP
\fB\-\-version\fR
output version information and exit
.PP
FORMAT controls the output.  Interpreted sequences are:
.TP
%%
a literal %
.TP
%a
locale's abbreviated weekday name (e.g., Sun)
.TP
%A
locale's full weekday name (e.g., Sunday)
.TP
%b
locale's abbreviated month name (e.g., Jan)
.TP
%B
locale's full month name (e.g., January)
.TP
%c
locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
.TP
%C
century; like %Y, except omit last two digits (e.g., 20)
.TP
%d
day of month (e.g., 01)
.TP
%D
date; same as %m/%d/%y
.TP
%e
day of month, space padded; same as %_d
.TP
%F
full date; like %+4Y\-%m\-%d
.TP
%g
last two digits of year of ISO week number (see %G)
.TP
%G
year of ISO week number (see %V); normally useful only with %V
.TP
%h
same as %b
.TP
%H
hour (00..23)
.TP
%I
hour (01..12)
.TP
%j
day of year (001..366)
.TP
%k
hour, space padded ( 0..23); same as %_H
.TP
%l
hour, space padded ( 1..12); same as %_I
.TP
%m
month (01..12)
.TP
%M
minute (00..59)
.TP
%n
a newline
.TP
%N
nanoseconds (000000000..999999999)
.TP
%p
locale's equivalent of either AM or PM; blank if not known
.TP
%P
like %p, but lower case
.TP
%q
quarter of year (1..4)
.TP
%r
locale's 12\-hour clock time (e.g., 11:11:04 PM)
.TP
%R
24\-hour hour and minute; same as %H:%M
.TP
%s
seconds since 1970\-01\-01 00:00:00 UTC
.TP
%S
second (00..60)
.TP
%t
a tab
.TP
%T
time; same as %H:%M:%S
.TP
%u
day of week (1..7); 1 is Monday
.TP
%U
week number of year, with Sunday as first day of week (00..53)
.TP
%V
ISO week number, with Monday as first day of week (01..53)
.TP
%w
day of week (0..6); 0 is Sunday
.TP
%W
week number of year, with Monday as first day of week (00..53)
.TP
%x
locale's date representation (e.g., 12/31/99)
.TP
%X
locale's time representation (e.g., 23:13:48)
.TP
%y
last two digits of year (00..99)
.TP
%Y
year
.TP
%z
+hhmm numeric time zone (e.g., \fB\-0400\fR)
.TP
%:z
+hh:mm numeric time zone (e.g., \fB\-04\fR:00)
.TP
%::z
+hh:mm:ss numeric time zone (e.g., \fB\-04\fR:00:00)
.TP
%:::z
numeric time zone with : to necessary precision (e.g., \fB\-04\fR, +05:30)
.TP
%Z
alphabetic time zone abbreviation (e.g., EDT)
.PP
By default, date pads numeric fields with zeroes.
The following optional flags may follow '%':
.TP
\-
(hyphen) do not pad the field
.TP
_
(underscore) pad with spaces
.TP
0
(zero) pad with zeros
.TP
+
pad with zeros, and put '+' before future years with >4 digits
.TP
^
use upper case if possible
.TP
#
use opposite case if possible
.PP
After any flags comes an optional field width, as a decimal number;
then an optional modifier, which is either
E to use the locale's alternate representations if available, or
O to use the locale's alternate numeric symbols if available.
.SH EXAMPLES
Convert seconds since the epoch (1970\-01\-01 UTC) to a date
.IP
\f(CW$ date --date='@2147483647'\fR
.PP
Show the time on the west coast of the US (use tzselect(1) to find TZ)
.IP
\f(CW$ TZ='America/Los_Angeles' date\fR
.PP
Show the local time for 9AM next Friday on the west coast of the US
.IP
\f(CW$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'\fR
.SH "DATE STRING"
.\" NOTE: keep this paragraph in sync with the one in touch.x
The --date=STRING is a mostly free format human readable date string
such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or
even "next Thursday".  A date string may contain items indicating
calendar date, time of day, time zone, day of week, relative time,
relative date, and numbers.  An empty string indicates the beginning
of the day.  The date string format is more complex than is easily
documented here but is fully described in the info documentation.
.SH AUTHOR
Written by David MacKenzie.
.SH "REPORTING BUGS"
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
.br
Report any translation bugs to <https://translationproject.org/team/>
.SH COPYRIGHT
Copyright \(co 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
Full documentation <https://www.gnu.org/software/coreutils/date>
.br
or available locally via: info \(aq(coreutils) date invocation\(aq