1DATESEQ(1) User Commands DATESEQ(1)
2
3
4
6 dateseq - Generate a sequence of date/times from FIRST to LAST, option‐
7 ally in steps of
8
10 dateseq [OPTION]... FIRST [[INCREMENT] LAST]
11
13 Generate a sequence of date/times from FIRST to LAST, optionally in
14 steps of INCREMENT (which defaults to `1d').
15
16 If LAST is omitted it defaults to `now' if FIRST is a date/time, or
17 `today' if FIRST is a date, or `time' if FIRST is a time.
18
19 The values of FIRST and LAST are always inclusive and no date/times be‐
20 fore FIRST and no date/times after LAST will be printed.
21
22 Negative INCREMENTs must be given, i.e. if FIRST is newer than LAST.
23
24
25 Recognized OPTIONs:
26
27 -h, --help
28 Print help and exit
29
30 -V, --version
31 Print version and exit
32
33 -q, --quiet
34 Suppress message about date/time and duration parser errors and
35 fix-ups. The default is to print a warning or the fixed up
36 value and return error code 2.
37
38 -f, --format=STRING
39 Output format. This can either be a specifier string (similar
40 to strftime()'s FMT) or the name of a calendar.
41
42 -i, --input-format=STRING...
43 Input format, can be used multiple times. Each date/time will
44 be passed to the input format parsers in the order they are
45 given, if a date/time can be read successfully with a given in‐
46 put format specifier string, that value will be used.
47
48 -b, --base=DT
49 For underspecified input use DT as a fallback to fill in missing
50 fields. Also used for ambiguous format specifiers to position
51 their range on the absolute time line. Must be a date/time in
52 ISO8601 format. If omitted defaults to the current date/time.
53
54 -e, --backslash-escapes
55 Enable interpretation of backslash escapes in the output and in‐
56 put format specifier strings.
57
58 --locale=LOCALE
59 Format results according to LOCALE, this would only affect month
60 and weekday names.
61
62 --from-locale=LOCALE
63 Interpret dates on stdin or the command line as coming from the
64 locale LOCALE, this would only affect month and weekday names as
65 input formats have to be specified explicitly.
66
67 -s, --skip=STRING...
68 Skip weekdays specified by STRING. STRING can be a single week‐
69 day (Mon, Tue, etc.), and to skip several days the --skip option
70 can be used multiple times. STRING can also be a comma-sepa‐
71 rated list of weekday names, or `ss' to skip weekends (sat+sun)
72 altogether. STRING can also contain date ranges like `mo-we'
73 for monday to wednesday.
74
75 --alt-inc=STRING
76 Alternative increment to use when a date is hit that is skipped
77 as per --skip. This increment will be applied until a non-
78 skipped date is reached. The special case `0' (default) deacti‐
79 vates alternative incrementing. A useful value could be `1d'
80 for increasing sequences and `-1d' for decreasing sequences, so
81 if a skipped date is encountered the next non-skipped date af‐
82 ter/before will be used.
83
84 --compute-from-last
85 Compute a start value from LAST using INCREMENT. This option
86 has an effect only when INCREMENT is not a divisor of the dura‐
87 tion between FIRST and LAST. In such case, an alternative FIRST
88 will be computed by consecutively subtracting INCREMENT from
89 LAST until FIRST is hit or crossed.
90
92 Format specs in dateutils are similar to posix' strftime().
93
94 However, due to a broader range of supported calendars dateutils must
95 employ different rules.
96
97 Date specs:
98 %a The abbreviated weekday name
99 %A The full weekday name
100 %_a The weekday name shortened to a single character (MTWRFAS)
101 %b The abbreviated month name
102 %B The full month name
103 %_b The month name shortened to a single character (FGHJKMNQUVXZ)
104 %c The count of the weekday within the month (range 00 to 05)
105 %C The count of the weekday within the year (range 00 to 53)
106 %d The day of the month, 2 digits (range 00 to 31)
107 %D The day of the year, 3 digits (range 000 to 366)
108 %F Equivalent to %Y-%m-%d (ymd's canonical format)
109 %g ISO week date year without the century (range 00 to 99)
110 %G ISO week date year including the century
111 %j Equivalent to %D
112 %m The month in the current calendar (range 00 to 12)
113 %Q The quarter of the year (range Q1 to Q4)
114 %q The number of the quarter (range 01 to 04)
115 %s The number of seconds since the Epoch.
116 %u The weekday as number (range 01 to 07, Sunday being 07)
117 %U The week count, day of week is Sun (range 00 to 53)
118 %V The ISO week count, day of week is Mon (range 01 to 53)
119 %w The weekday as number (range 00 to 06, Sunday being 00)
120 %W The week count, day of week is Mon (range 00 to 53)
121 %y The year without a century (range 00 to 99)
122 %Y The year including the century
123 %_y The year shortened to a single digit
124 %Z The zone offset in hours and minutes (HH:MM) with
125 a preceding sign (+ for offsets east of UTC, - for offsets
126 west of UTC)
127
128 %Od The day as roman numerals
129 %Om The month as roman numerals
130 %Oy The two digit year as roman numerals
131 %OY The year including the century as roman numerals
132
133 %rs In time systems whose Epoch is different from the unix Epoch, this
134 selects the number of seconds since then.
135 %rY In calendars with years that don't coincide with the Gregorian
136 years, this selects the calendar's year.
137
138 %dth The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
139 %mth The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
140
141 %db The business day of the month (since last month's ultimo)
142 %dB Number of business days until this month's ultimo
143
144 Time specs:
145 %H The hour of the day using a 24h clock, 2 digits (range 00 to 23)
146 %I The hour of the day using a 12h clock, 2 digits (range 01 to 12)
147 %M The minute (range 00 to 59)
148 %N The nanoseconds (range 000000000 to 999999999)
149 %p The string AM or PM, noon is PM and midnight is AM.
150 %P Like %p but in lowercase
151 %S The (range 00 to 60, 60 is for leap seconds)
152 %T Equivalent to %H:%M:%S
153
154 General specs:
155 %n A newline character
156 %t A tab character
157 %% A literal % character
158
159 Modifiers:
160 %O Modifier to turn decimal numbers into Roman numerals
161 %r Modifier to turn units into real units
162 %0 Modifier to turn on zero prefixes
163 %SPC Modifier to turn on space prefixes
164 %- Modifier to turn off prefixes altogether
165 th Suffix, read and print ordinal numbers
166 b Suffix, treat days as business days
167
168 By design dates before 1601-01-01 are not supported.
169
170 For conformity here is a list of calendar designators and their corre‐
171 sponding format string:
172 ymd %Y-%m-%d
173 ymcw %Y-%m-%c-%w
174 ywd %rY-W%V-%u
175 bizda %Y-%m-%db
176 lilian n/a
177 ldn n/a
178 julian n/a
179 jdn n/a
180 matlab n/a
181 mdn n/a
182
183 These designators can be used as output format string, moreover,
184 @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be used
185 as input format string.
186
187
189 Some tools ("dateadd", "dateseq") need durations as their input. Dura‐
190 tions are generally incompatible with input formats as specified by
191 "-i|--input-format" and (at the moment) the input syntax is fixed.
192
193 The general format is "+-Nunit" where "+" or "-" is the sign, "N" a
194 number, and "unit" the unit as discussed below.
195
196 Units:
197 s seconds
198 m minutes
199 h hours
200 rs real-life seconds, as in including leap transitions
201
202 d days
203 b business days
204 mo months
205 y years
206
207 For historical reasons, we used to accept "m" in the context of date-
208 only input as a qualifier for months. As of 0.4.4, this is no longer
209 the case.
210
211
213 $ dateseq 2012-02-01 2012-03-01
214 2012-02-01
215 2012-02-02
216 2012-02-03
217 2012-02-04
218 2012-02-05
219 2012-02-06
220 2012-02-07
221 2012-02-08
222 2012-02-09
223 2012-02-10
224 2012-02-11
225 2012-02-12
226 2012-02-13
227 2012-02-14
228 2012-02-15
229 2012-02-16
230 2012-02-17
231 2012-02-18
232 2012-02-19
233 2012-02-20
234 2012-02-21
235 2012-02-22
236 2012-02-23
237 2012-02-24
238 2012-02-25
239 2012-02-26
240 2012-02-27
241 2012-02-28
242 2012-02-29
243 2012-03-01
244 $
245
246 $ dateseq 2001-02-03 2001-03-03 --skip sat -f "%F %a"
247 2001-02-04 Sun
248 2001-02-05 Mon
249 2001-02-06 Tue
250 2001-02-07 Wed
251 2001-02-08 Thu
252 2001-02-09 Fri
253 2001-02-11 Sun
254 2001-02-12 Mon
255 2001-02-13 Tue
256 2001-02-14 Wed
257 2001-02-15 Thu
258 2001-02-16 Fri
259 2001-02-18 Sun
260 2001-02-19 Mon
261 2001-02-20 Tue
262 2001-02-21 Wed
263 2001-02-22 Thu
264 2001-02-23 Fri
265 2001-02-25 Sun
266 2001-02-26 Mon
267 2001-02-27 Tue
268 2001-02-28 Wed
269 2001-03-01 Thu
270 2001-03-02 Fri
271 $
272
273 $ dateseq --compute-from-last 2001-02-03 1 2001-03-03 --skip sat -f "%F %a"
274 2001-02-04 Sun
275 2001-02-05 Mon
276 2001-02-06 Tue
277 2001-02-07 Wed
278 2001-02-08 Thu
279 2001-02-09 Fri
280 2001-02-11 Sun
281 2001-02-12 Mon
282 2001-02-13 Tue
283 2001-02-14 Wed
284 2001-02-15 Thu
285 2001-02-16 Fri
286 2001-02-18 Sun
287 2001-02-19 Mon
288 2001-02-20 Tue
289 2001-02-21 Wed
290 2001-02-22 Thu
291 2001-02-23 Fri
292 2001-02-25 Sun
293 2001-02-26 Mon
294 2001-02-27 Tue
295 2001-02-28 Wed
296 2001-03-01 Thu
297 2001-03-02 Fri
298 $
299
300 $ dateseq 2001-02-03 3 2001-03-03 --skip sat,fri -f "%F %a"
301 2001-02-06 Tue
302 2001-02-12 Mon
303 2001-02-15 Thu
304 2001-02-18 Sun
305 2001-02-21 Wed
306 2001-02-27 Tue
307 $
308
309 $ dateseq --compute-from-last 2001-02-03 3 2001-03-03 --skip sat,fri -f "%F %a"
310 2001-02-04 Sun
311 2001-02-07 Wed
312 2001-02-13 Tue
313 2001-02-19 Mon
314 2001-02-22 Thu
315 2001-02-25 Sun
316 2001-02-28 Wed
317 $
318
319 $ dateseq 2001-02-05 4 2001-03-04 -f "%F %a"
320 2001-02-05 Mon
321 2001-02-09 Fri
322 2001-02-13 Tue
323 2001-02-17 Sat
324 2001-02-21 Wed
325 2001-02-25 Sun
326 2001-03-01 Thu
327 $
328
329 $ dateseq --compute-from-last 2001-02-05 4 2001-03-04 -f "%F %a"
330 2001-02-08 Thu
331 2001-02-12 Mon
332 2001-02-16 Fri
333 2001-02-20 Tue
334 2001-02-24 Sat
335 2001-02-28 Wed
336 2001-03-04 Sun
337 $
338
339 $ dateseq --alt-inc 1d 2001-02-03 3 2001-03-03 --skip sat,fri -f "%F %a"
340 2001-02-04 Sun
341 2001-02-07 Wed
342 2001-02-11 Sun
343 2001-02-14 Wed
344 2001-02-18 Sun
345 2001-02-21 Wed
346 2001-02-25 Sun
347 2001-02-28 Wed
348 $
349
350 $ dateseq --compute-from-last --alt-inc 1d 2001-02-03 3 2001-03-03 --skip sat,fri -f "%F %a"
351 2001-02-04 Sun
352 2001-02-07 Wed
353 2001-02-11 Sun
354 2001-02-14 Wed
355 2001-02-18 Sun
356 2001-02-21 Wed
357 2001-02-25 Sun
358 2001-02-28 Wed
359 $
360
361 $ dateseq 2001-01-01 2d 2001-01-08
362 2001-01-01
363 2001-01-03
364 2001-01-05
365 2001-01-07
366 $
367
368 $ dateseq --compute-from-last 2001-01-01 2d 2001-01-08
369 2001-01-02
370 2001-01-04
371 2001-01-06
372 2001-01-08
373 $
374
375 $ dateseq 2001-01-08 -2d 2001-01-01
376 2001-01-08
377 2001-01-06
378 2001-01-04
379 2001-01-02
380 $
381
382 $ dateseq --compute-from-last 2001-01-08 -2d 2001-01-01
383 2001-01-07
384 2001-01-05
385 2001-01-03
386 2001-01-01
387 $
388
389 $ dateseq 10:00:00 12m 11:20:00
390 10:00:00
391 10:12:00
392 10:24:00
393 10:36:00
394 10:48:00
395 11:00:00
396 11:12:00
397 $
398
399 $ dateseq --compute-from-last 10:00:00 12m 11:20:00
400 10:08:00
401 10:20:00
402 10:32:00
403 10:44:00
404 10:56:00
405 11:08:00
406 11:20:00
407 $
408
409 $ dateseq 11:20:00 -12m 10:00:00
410 11:20:00
411 11:08:00
412 10:56:00
413 10:44:00
414 10:32:00
415 10:20:00
416 10:08:00
417 $
418
419 $ dateseq --compute-from-last 11:20:00 -12m 10:00:00
420 11:12:00
421 11:00:00
422 10:48:00
423 10:36:00
424 10:24:00
425 10:12:00
426 10:00:00
427 $
428
430 Written by Sebastian Freundt <freundt@fresse.org>
431
433 Report bugs to: https://github.com/hroptatyr/dateutils/issues
434
436 The full documentation for dateseq is maintained as a Texinfo manual.
437 If the info and dateseq programs are properly installed at your site,
438 the command
439
440 info (dateutils)dateseq
441
442 should give you access to the complete manual.
443
444
445
446dateutils 0.4.10 May 2022 DATESEQ(1)