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