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