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