1DATECONV(1) User Commands DATECONV(1)
2
3
4
6 dateconv - Convert DATE/TIMEs between calendrical systems.
7
9 dateconv [OPTION]... [DATE/TIME]...
10
12 Convert DATE/TIMEs between calendrical systems. If DATE/TIME is omit‐
13 ted date/times are read from stdin.
14
15 DATE/TIME can also be one of the following specials
16 - `now' interpreted as the current (UTC) time stamp
17 - `time' the time part of the current (UTC) time stamp
18 - `today' the current date (according to UTC)
19 - `tomo[rrow]' tomorrow's date (according to UTC)
20 - `y[ester]day' yesterday's date (according to UTC)
21
22
23 Recognized OPTIONs:
24
25 -h, --help
26 Print help and exit
27
28 -V, --version
29 Print version and exit
30
31 -q, --quiet
32 Suppress message about date/time and duration parser errors and
33 fix-ups. The default is to print a warning or the fixed up
34 value and return error code 2.
35
36 -f, --format=STRING
37 Output format. This can either be a specifier string (similar
38 to strftime()'s FMT) or the name of a calendar.
39
40 -i, --input-format=STRING...
41 Input format, can be used multiple times. Each date/time will
42 be passed to the input format parsers in the order they are
43 given, if a date/time can be read successfully with a given
44 input format specifier string, that value will be used.
45
46 -b, --base=DT
47 For underspecified input use DT as a fallback to fill in missing
48 fields. Also used for ambiguous format specifiers to position
49 their range on the absolute time line. Must be a date/time in
50 ISO8601 format. If omitted defaults to the current date/time.
51
52 -e, --backslash-escapes
53 Enable interpretation of backslash escapes in the output and
54 input format specifier strings.
55
56 -S, --sed-mode
57 Copy parts from the input before and after a matching date/time.
58 Note that all occurrences of date/times within a line will be
59 processed.
60
61 -E, --empty-mode
62 Empty lines that cannot be parsed.
63
64 --locale=LOCALE
65 Format results according to LOCALE, this would only affect month
66 and weekday names.
67
68 --from-locale=LOCALE
69 Interpret dates on stdin or the command line as coming from the
70 locale LOCALE, this would only affect month and weekday names as
71 input formats have to be specified explicitly.
72
73 --from-zone=ZONE
74 Interpret dates on stdin or the command line as coming from the
75 time zone ZONE.
76
77 -z, --zone=ZONE
78 Convert dates printed on stdout to time zone ZONE, default: UTC.
79
81 Format specs in dateutils are similar to posix' strftime().
82
83 However, due to a broader range of supported calendars dateutils must
84 employ different rules.
85
86 Date specs:
87 %a The abbreviated weekday name
88 %A The full weekday name
89 %_a The weekday name shortened to a single character (MTWRFAS)
90 %b The abbreviated month name
91 %B The full month name
92 %_b The month name shortened to a single character (FGHJKMNQUVXZ)
93 %c The count of the weekday within the month (range 00 to 05)
94 %C The count of the weekday within the year (range 00 to 53)
95 %d The day of the month, 2 digits (range 00 to 31)
96 %D The day of the year, 3 digits (range 000 to 366)
97 %F Equivalent to %Y-%m-%d (ymd's canonical format)
98 %g ISO week date year without the century (range 00 to 99)
99 %G ISO week date year including the century
100 %j Equivalent to %D
101 %m The month in the current calendar (range 00 to 19)
102 %Q The quarter of the year (range Q1 to Q4)
103 %q The number of the quarter (range 01 to 04)
104 %s The number of seconds since the Epoch.
105 %u The weekday as number (range 01 to 07, Sunday being 07)
106 %U The week count, day of week is Sun (range 00 to 53)
107 %V The ISO week count, day of week is Mon (range 01 to 53)
108 %w The weekday as number (range 00 to 06, Sunday being 00)
109 %W The week count, day of week is Mon (range 00 to 53)
110 %y The year without a century (range 00 to 99)
111 %Y The year including the century
112 %_y The year shortened to a single digit
113 %Z The zone offset in hours and minutes (HH:MM) with
114 a preceding sign (+ for offsets east of UTC, - for offsets
115 west of UTC)
116
117 %Od The day as roman numerals
118 %Om The month as roman numerals
119 %Oy The two digit year as roman numerals
120 %OY The year including the century as roman numerals
121
122 %rs In time systems whose Epoch is different from the unix Epoch, this
123 selects the number of seconds since then.
124 %rY In calendars with years that don't coincide with the Gregorian
125 years, this selects the calendar's year.
126
127 %dth The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
128 %mth The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
129
130 %db The business day of the month (since last month's ultimo)
131 %dB Number of business days until this month's ultimo
132
133 Time specs:
134 %H The hour of the day using a 24h clock, 2 digits (range 00 to 23)
135 %I The hour of the day using a 12h clock, 2 digits (range 01 to 12)
136 %M The minute (range 00 to 59)
137 %N The nanoseconds (range 000000000 to 999999999)
138 %p The string AM or PM, noon is PM and midnight is AM.
139 %P Like %p but in lowercase
140 %S The (range 00 to 60, 60 is for leap seconds)
141 %T Equivalent to %H:%M:%S
142
143 General specs:
144 %n A newline character
145 %t A tab character
146 %% A literal % character
147
148 Modifiers:
149 %O Modifier to turn decimal numbers into Roman numerals
150 %r Modifier to turn units into real units
151 %0 Modifier to turn on zero prefixes
152 %SPC Modifier to turn on space prefixes
153 %- Modifier to turn off prefixes altogether
154 th Suffix, read and print ordinal numbers
155 b Suffix, treat days as business days
156
157 By design dates before 1601-01-01 are not supported.
158
159 For conformity here is a list of calendar designators and their corre‐
160 sponding format string:
161 ymd %Y-%m-%d
162 ymcw %Y-%m-%c-%w
163 ywd %rY-W%V-%u
164 bizda %Y-%m-%db
165 lilian n/a
166 ldn n/a
167 julian n/a
168 jdn n/a
169 matlab n/a
170 mdn n/a
171
172 These designators can be used as output format string, moreover,
173 @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be used
174 as input format string.
175
176
178 $ dateconv 2012-03-01
179 2012-03-01
180 $
181
182 $ dateconv -i "%d/%b/%y" 01/Mar/12
183 2012-03-01
184 $
185
186 $ dateconv -f "%d/%b/%y" 2012-03-01
187 01/Mar/12
188 $
189
190 $ dateconv -f "%d/%b/%y" -i "%OY %Om %Od" "MCMXCVIII IX XVII"
191 17/Sep/98
192 $
193
194 $ dateconv 12:03:01
195 12:03:01
196 $
197
198 $ dateconv -i "%I:%M:%S %p" "11:22:33 PM"
199 23:22:33
200 $
201
202 $ dateconv '2012-03-01 00:00:00'
203 2012-03-01T00:00:00
204 $
205
206 $ dateconv 2012-03-01T12:34:56
207 2012-03-01T12:34:56
208 $
209
210 $ dateconv --zone America/Chicago <<EOF
211 2012-03-01T07:05:06
212 2012-03-01T08:12:34
213 2012-03-11T01:05:06
214 2012-03-11T02:05:06
215 2012-03-11T07:05:06
216 2012-03-11T08:05:06
217 2012-03-11T17:05:06
218 EOF
219 2012-03-01T01:05:06
220 2012-03-01T02:12:34
221 2012-03-10T19:05:06
222 2012-03-10T20:05:06
223 2012-03-11T01:05:06
224 2012-03-11T03:05:06
225 2012-03-11T12:05:06
226 $
227
228 $ dateconv --from-zone America/Chicago <<EOF
229 2012-03-01T01:05:06
230 2012-03-01T02:12:34
231 2012-03-10T19:05:06
232 2012-03-10T20:05:06
233 2012-03-11T01:05:06
234 2012-03-11T03:05:06
235 2012-03-11T12:05:06
236 EOF
237 2012-03-01T07:05:06
238 2012-03-01T08:12:34
239 2012-03-11T01:05:06
240 2012-03-11T02:05:06
241 2012-03-11T07:05:06
242 2012-03-11T08:05:06
243 2012-03-11T17:05:06
244 $
245
246 $ dateconv --from-zone America/Chicago -z Europe/Berlin '2012-03-01 12:00' -i '%F %H:%M' -f '%F %T'
247 2012-03-01 19:00:00
248 $
249
251 Written by Sebastian Freundt <freundt@fresse.org>
252
254 Report bugs to: https://github.com/hroptatyr/dateutils/issues
255
257 The full documentation for dateconv is maintained as a Texinfo manual.
258 If the info and dateconv programs are properly installed at your site,
259 the command
260
261 info (dateutils)dateconv
262
263 should give you access to the complete manual.
264
265
266
267dateutils 0.4.6 March 2019 DATECONV(1)