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