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 --locale=LOCALE
62 Format results according to LOCALE, this would only affect month
63 and weekday names.
64
65 --from-locale=LOCALE
66 Interpret dates on stdin or the command line as coming from the
67 locale LOCALE, this would only affect month and weekday names as
68 input formats have to be specified explicitly.
69
70 --from-zone=ZONE
71 Interpret dates on stdin or the command line as coming from the
72 time zone ZONE.
73
74 -z, --zone=ZONE
75 Convert dates printed on stdout to time zone ZONE, default: UTC.
76
78 Format specs in dateutils are similar to posix' strftime().
79
80 However, due to a broader range of supported calendars dateutils must
81 employ different rules.
82
83 Date specs:
84 %a The abbreviated weekday name
85 %A The full weekday name
86 %_a The weekday name shortened to a single character (MTWRFAS)
87 %b The abbreviated month name
88 %B The full month name
89 %_b The month name shortened to a single character (FGHJKMNQUVXZ)
90 %c The count of the weekday within the month (range 00 to 05)
91 %C The count of the weekday within the year (range 00 to 53)
92 %d The day of the month, 2 digits (range 00 to 31)
93 %D The day of the year, 3 digits (range 000 to 366)
94 %F Equivalent to %Y-%m-%d (ymd's canonical format)
95 %g ISO week date year without the century (range 00 to 99)
96 %G ISO week date year including the century
97 %j Equivalent to %D
98 %m The month in the current calendar (range 00 to 19)
99 %Q The quarter of the year (range Q1 to Q4)
100 %q The number of the quarter (range 01 to 04)
101 %s The number of seconds since the Epoch.
102 %u The weekday as number (range 01 to 07, Sunday being 07)
103 %U The week count, day of week is Sun (range 00 to 53)
104 %V The ISO week count, day of week is Mon (range 01 to 53)
105 %w The weekday as number (range 00 to 06, Sunday being 00)
106 %W The week count, day of week is Mon (range 00 to 53)
107 %y The year without a century (range 00 to 99)
108 %Y The year including the century
109 %_y The year shortened to a single digit
110 %Z The zone offset in hours and minutes (HH:MM) with
111 a preceding sign (+ for offsets east of UTC, - for offsets
112 west of UTC)
113
114 %Od The day as roman numerals
115 %Om The month as roman numerals
116 %Oy The two digit year as roman numerals
117 %OY The year including the century as roman numerals
118
119 %rs In time systems whose Epoch is different from the unix Epoch, this
120 selects the number of seconds since then.
121 %rY In calendars with years that don't coincide with the Gregorian
122 years, this selects the calendar's year.
123
124 %dth The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
125 %mth The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
126
127 %db The business day of the month (since last month's ultimo)
128 %dB Number of business days until this month's ultimo
129
130 Time specs:
131 %H The hour of the day using a 24h clock, 2 digits (range 00 to 23)
132 %I The hour of the day using a 12h clock, 2 digits (range 01 to 12)
133 %M The minute (range 00 to 59)
134 %N The nanoseconds (range 000000000 to 999999999)
135 %p The string AM or PM, noon is PM and midnight is AM.
136 %P Like %p but in lowercase
137 %S The (range 00 to 60, 60 is for leap seconds)
138 %T Equivalent to %H:%M:%S
139
140 General specs:
141 %n A newline character
142 %t A tab character
143 %% A literal % character
144
145 Modifiers:
146 %O Modifier to turn decimal numbers into Roman numerals
147 %r Modifier to turn units into real units
148 %0 Modifier to turn on zero prefixes
149 %SPC Modifier to turn on space prefixes
150 %- Modifier to turn off prefixes altogether
151 th Suffix, read and print ordinal numbers
152 b Suffix, treat days as business days
153
154 By design dates before 1601-01-01 are not supported.
155
156 For conformity here is a list of calendar designators and their corre‐
157 sponding format string:
158 ymd %Y-%m-%d
159 ymcw %Y-%m-%c-%w
160 ywd %rY-W%V-%u
161 bizda %Y-%m-%db
162 lilian n/a
163 ldn n/a
164 julian n/a
165 jdn n/a
166 matlab n/a
167 mdn n/a
168
169 These designators can be used as output format string, moreover,
170 @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be used
171 as input format string.
172
173
175 $ dateconv 2012-03-01
176 2012-03-01
177 $
178
179 $ dateconv -i "%d/%b/%y" 01/Mar/12
180 2012-03-01
181 $
182
183 $ dateconv -f "%d/%b/%y" 2012-03-01
184 01/Mar/12
185 $
186
187 $ dateconv -f "%d/%b/%y" -i "%OY %Om %Od" "MCMXCVIII IX XVII"
188 17/Sep/98
189 $
190
191 $ dateconv 12:03:01
192 12:03:01
193 $
194
195 $ dateconv -i "%I:%M:%S %p" "11:22:33 PM"
196 23:22:33
197 $
198
199 $ dateconv '2012-03-01 00:00:00'
200 2012-03-01T00:00:00
201 $
202
203 $ dateconv 2012-03-01T12:34:56
204 2012-03-01T12:34:56
205 $
206
207 $ dateconv --zone America/Chicago <<EOF
208 2012-03-01T07:05:06
209 2012-03-01T08:12:34
210 2012-03-11T01:05:06
211 2012-03-11T02:05:06
212 2012-03-11T07:05:06
213 2012-03-11T08:05:06
214 2012-03-11T17:05:06
215 EOF
216 2012-03-01T01:05:06
217 2012-03-01T02:12:34
218 2012-03-10T19:05:06
219 2012-03-10T20:05:06
220 2012-03-11T01:05:06
221 2012-03-11T03:05:06
222 2012-03-11T12:05:06
223 $
224
225 $ dateconv --from-zone America/Chicago <<EOF
226 2012-03-01T01:05:06
227 2012-03-01T02:12:34
228 2012-03-10T19:05:06
229 2012-03-10T20:05:06
230 2012-03-11T01:05:06
231 2012-03-11T03:05:06
232 2012-03-11T12:05:06
233 EOF
234 2012-03-01T07:05:06
235 2012-03-01T08:12:34
236 2012-03-11T01:05:06
237 2012-03-11T02:05:06
238 2012-03-11T07:05:06
239 2012-03-11T08:05:06
240 2012-03-11T17:05:06
241 $
242
243 $ dateconv --from-zone America/Chicago -z Europe/Berlin '2012-03-01 12:00' -i '%F %H:%M' -f '%F %T'
244 2012-03-01 19:00:00
245 $
246
248 Written by Sebastian Freundt <freundt@fresse.org>
249
251 Report bugs to: https://github.com/hroptatyr/dateutils/issues
252
254 The full documentation for dateconv is maintained as a Texinfo manual.
255 If the info and dateconv programs are properly installed at your site,
256 the command
257
258 info (dateutils)dateconv
259
260 should give you access to the complete manual.
261
262
263
264dateutils 0.4.4 August 2018 DATECONV(1)