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 All options that specify the date to display are mutually exclusive.
63 I.e.: --date, --file, --reference, --resolution.
64
65 FORMAT controls the output. Interpreted sequences are:
66
67 %% a literal %
68
69 %a locale's abbreviated weekday name (e.g., Sun)
70
71 %A locale's full weekday name (e.g., Sunday)
72
73 %b locale's abbreviated month name (e.g., Jan)
74
75 %B locale's full month name (e.g., January)
76
77 %c locale's date and time (e.g., Thu Mar 3 23:05:25 2005)
78
79 %C century; like %Y, except omit last two digits (e.g., 20)
80
81 %d day of month (e.g., 01)
82
83 %D date; same as %m/%d/%y
84
85 %e day of month, space padded; same as %_d
86
87 %F full date; like %+4Y-%m-%d
88
89 %g last two digits of year of ISO week number (see %G)
90
91 %G year of ISO week number (see %V); normally useful only with %V
92
93 %h same as %b
94
95 %H hour (00..23)
96
97 %I hour (01..12)
98
99 %j day of year (001..366)
100
101 %k hour, space padded ( 0..23); same as %_H
102
103 %l hour, space padded ( 1..12); same as %_I
104
105 %m month (01..12)
106
107 %M minute (00..59)
108
109 %n a newline
110
111 %N nanoseconds (000000000..999999999)
112
113 %p locale's equivalent of either AM or PM; blank if not known
114
115 %P like %p, but lower case
116
117 %q quarter of year (1..4)
118
119 %r locale's 12-hour clock time (e.g., 11:11:04 PM)
120
121 %R 24-hour hour and minute; same as %H:%M
122
123 %s seconds since the Epoch (1970-01-01 00:00 UTC)
124
125 %S second (00..60)
126
127 %t a tab
128
129 %T time; same as %H:%M:%S
130
131 %u day of week (1..7); 1 is Monday
132
133 %U week number of year, with Sunday as first day of week (00..53)
134
135 %V ISO week number, with Monday as first day of week (01..53)
136
137 %w day of week (0..6); 0 is Sunday
138
139 %W week number of year, with Monday as first day of week (00..53)
140
141 %x locale's date representation (e.g., 12/31/99)
142
143 %X locale's time representation (e.g., 23:13:48)
144
145 %y last two digits of year (00..99)
146
147 %Y year
148
149 %z +hhmm numeric time zone (e.g., -0400)
150
151 %:z +hh:mm numeric time zone (e.g., -04:00)
152
153 %::z +hh:mm:ss numeric time zone (e.g., -04:00:00)
154
155 %:::z numeric time zone with : to necessary precision (e.g., -04,
156 +05:30)
157
158 %Z alphabetic time zone abbreviation (e.g., EDT)
159
160 By default, date pads numeric fields with zeroes. The following op‐
161 tional flags may follow '%':
162
163 - (hyphen) do not pad the field
164
165 _ (underscore) pad with spaces
166
167 0 (zero) pad with zeros
168
169 + pad with zeros, and put '+' before future years with >4 digits
170
171 ^ use upper case if possible
172
173 # use opposite case if possible
174
175 After any flags comes an optional field width, as a decimal number;
176 then an optional modifier, which is either E to use the locale's alter‐
177 nate representations if available, or O to use the locale's alternate
178 numeric symbols if available.
179
181 Convert seconds since the Epoch (1970-01-01 UTC) to a date
182
183 $ date --date='@2147483647'
184
185 Show the time on the west coast of the US (use tzselect(1) to find TZ)
186
187 $ TZ='America/Los_Angeles' date
188
189 Show the local time for 9AM next Friday on the west coast of the US
190
191 $ date --date='TZ="America/Los_Angeles" 09:00 next Fri'
192
194 The --date=STRING is a mostly free format human readable date string
195 such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or
196 even "next Thursday". A date string may contain items indicating cal‐
197 endar date, time of day, time zone, day of week, relative time, rela‐
198 tive date, and numbers. An empty string indicates the beginning of the
199 day. The date string format is more complex than is easily documented
200 here but is fully described in the info documentation.
201
203 Written by David MacKenzie.
204
206 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
207 Report any translation bugs to <https://translationproject.org/team/>
208
210 Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU
211 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
212 This is free software: you are free to change and redistribute it.
213 There is NO WARRANTY, to the extent permitted by law.
214
216 Full documentation <https://www.gnu.org/software/coreutils/date>
217 or available locally via: info '(coreutils) date invocation'
218
219
220
221GNU coreutils 9.3 September 2023 DATE(1)