1DATEROUND(1)                     User Commands                    DATEROUND(1)
2
3
4

NAME

6       dateround - Round DATE/TIME to the next occurrence of RNDSPEC.
7

SYNOPSIS

9       dateround [OPTION]...  [DATE/TIME] RNDSPEC...
10

DESCRIPTION

12       Round DATE/TIME to the next occurrence of RNDSPEC.
13
14       If DATE/TIME is omitted a stream of date/times is read from stdin.
15
16       DATE/TIME can also be one of the following specials
17         - `now'           interpreted as the current (UTC) time stamp
18         - `time'          the time part of the current (UTC) time stamp
19         - `today'         the current date (according to UTC)
20         - `tomo[rrow]'    tomorrow's date (according to UTC)
21         - `y[ester]day'   yesterday's date (according to UTC)
22
23       RNDSPECs  can  be month names (Jan, Feb, ...), weekday names (Sun, Mon,
24       ...), or days.   If  a  month  name  the  next  date/time  relative  to
25       DATE/TIME  is  returned  whose  month  part matches the value given, so
26       e.`g. dateround 2012-01-01 Feb' will return 2012-02-01.  If  a  weekday
27       name  is  given,  the next date/time after DATE/TIME whose weekday part
28       matches the values given is returned.  If a  day,  the  next  date/time
29       after  DATE/TIME  whose  day  part  matches  is returned, so `dateround
30       2012-01-15 1' will return 2012-02-01.
31
32       RNDSPECs can also be multiples of the day dividing units, e.g 1h rounds
33       to  the nearest full hour, 30m to the nearest half hour, and 10s to the
34       next 10s mark.
35
36       To round to the previous occurrence of a RNDSPEC any  argument  can  be
37       prefixed  with  a  `-'  to denote that.  E.g. `dateround 2012-02-14 -1'
38       will return 2012-02-01.  And `dateround 2012-02-11 -- -Sep' will return
39       2011-09-11.
40
41       Multiple RNDSPECs are evaluated left to right.
42
43       Note  that rounding isn't commutative, e.g.       2012-03-01 Sat Sep ->
44       2012-09-03 vs.       2012-03-01 Sep Sat -> 2012-09-01
45
46       Note that non-numeric strings prefixed with a  `-'  conflict  with  the
47       command line options and a separating `--' has to be used.
48
49
50       Recognized OPTIONs:
51
52       -h, --help
53              Print help and exit
54
55       -V, --version
56              Print version and exit
57
58       -q, --quiet
59              Suppress  message about date/time and duration parser errors and
60              fix-ups.  The default is to print a  warning  or  the  fixed  up
61              value and return error code 2.
62
63       -f, --format=STRING
64              Output  format.   This can either be a specifier string (similar
65              to strftime()'s FMT) or the name of a calendar.
66
67       -i, --input-format=STRING...
68              Input format, can be used multiple times.  Each  date/time  will
69              be  passed  to  the  input  format parsers in the order they are
70              given, if a date/time can be  read  successfully  with  a  given
71              input format specifier string, that value will be used.
72
73       -b, --base=DT
74              For underspecified input use DT as a fallback to fill in missing
75              fields.  Also used for ambiguous format specifiers  to  position
76              their  range  on the absolute time line.  Must be a date/time in
77              ISO8601 format.  If omitted defaults to the current date/time.
78
79       -e, --backslash-escapes
80              Enable interpretation of backslash escapes  in  the  output  and
81              input format specifier strings.
82
83       -S, --sed-mode
84              Copy parts from the input before and after a matching date/time.
85              Note that all occurrences of date/times within a  line  will  be
86              processed.
87
88       --locale=LOCALE
89              Format results according to LOCALE, this would only affect month
90              and weekday names.
91
92       --from-locale=LOCALE
93              Interpret dates on stdin or the command line as coming from  the
94              locale LOCALE, this would only affect month and weekday names as
95              input formats have to be specified explicitly.
96
97       --from-zone=ZONE
98              Interpret dates on stdin or the command line as coming from  the
99              time zone ZONE.
100
101       -z, --zone=ZONE
102              Convert dates printed on stdout to time zone ZONE, default: UTC.
103
104       -n, --next
105              Always round to a different date or time.
106

FORMAT SPECS

108       Format specs in dateutils are similar to posix' strftime().
109
110       However,  due  to a broader range of supported calendars dateutils must
111       employ different rules.
112
113       Date specs:
114         %a  The abbreviated weekday name
115         %A  The full weekday name
116         %_a The weekday name shortened to a single character (MTWRFAS)
117         %b  The abbreviated month name
118         %B  The full month name
119         %_b The month name shortened to a single character (FGHJKMNQUVXZ)
120         %c  The count of the weekday within the month (range 00 to 05)
121         %C  The count of the weekday within the year (range 00 to 53)
122         %d  The day of the month, 2 digits (range 00 to 31)
123         %D  The day of the year, 3 digits (range 000 to 366)
124         %F  Equivalent to %Y-%m-%d (ymd's canonical format)
125         %g  ISO week date year without the century (range 00 to 99)
126         %G  ISO week date year including the century
127         %j  Equivalent to %D
128         %m  The month in the current calendar (range 00 to 19)
129         %Q  The quarter of the year (range Q1 to Q4)
130         %q  The number of the quarter (range 01 to 04)
131         %s  The number of seconds since the Epoch.
132         %u  The weekday as number (range 01 to 07, Sunday being 07)
133         %U  The week count,  day of week is Sun (range 00 to 53)
134         %V  The ISO week count,  day of week is Mon (range 01 to 53)
135         %w  The weekday as number (range 00 to 06, Sunday being 00)
136         %W  The week count,  day of week is Mon (range 00 to 53)
137         %y  The year without a century (range 00 to 99)
138         %Y  The year including the century
139         %_y The year shortened to a single digit
140         %Z  The zone offset in hours and minutes (HH:MM) with
141             a preceding sign (+ for offsets east of UTC, - for offsets
142             west of UTC)
143
144         %Od The day as roman numerals
145         %Om The month as roman numerals
146         %Oy The two digit year as roman numerals
147         %OY The year including the century as roman numerals
148
149         %rs In time systems whose Epoch is different from the unix Epoch, this
150             selects the number of seconds since then.
151         %rY In calendars with years that don't coincide with the Gregorian
152             years, this selects the calendar's year.
153
154         %dth  The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
155         %mth  The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
156
157         %db The business day of the month (since last month's ultimo)
158         %dB Number of business days until this month's ultimo
159
160       Time specs:
161         %H  The hour of the day using a 24h clock, 2 digits (range 00 to 23)
162         %I  The hour of the day using a 12h clock, 2 digits (range 01 to 12)
163         %M  The minute (range 00 to 59)
164         %N  The nanoseconds (range 000000000 to 999999999)
165         %p  The string AM or PM, noon is PM and midnight is AM.
166         %P  Like %p but in lowercase
167         %S  The  (range 00 to 60, 60 is for leap seconds)
168         %T  Equivalent to %H:%M:%S
169
170       General specs:
171         %n  A newline character
172         %t  A tab character
173         %%  A literal % character
174
175       Modifiers:
176         %O  Modifier to turn decimal numbers into Roman numerals
177         %r  Modifier to turn units into real units
178         %0  Modifier to turn on zero prefixes
179         %SPC  Modifier to turn on space prefixes
180         %-  Modifier to turn off prefixes altogether
181         th  Suffix, read and print ordinal numbers
182         b   Suffix, treat days as business days
183
184       By design dates before 1601-01-01 are not supported.
185
186       For conformity here is a list of calendar designators and their  corre‐
187       sponding format string:
188         ymd     %Y-%m-%d
189         ymcw    %Y-%m-%c-%w
190         ywd     %rY-W%V-%u
191         bizda   %Y-%m-%db
192         lilian     n/a
193         ldn        n/a
194         julian     n/a
195         jdn        n/a
196         matlab     n/a
197         mdn        n/a
198
199       These  designators  can  be  used  as  output  format string, moreover,
200       @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be  used
201       as input format string.
202
203

SPECIFYING DURATIONS

205       Some tools ("dateadd", "dateseq") need durations as their input.  Dura‐
206       tions are generally incompatible with input  formats  as  specified  by
207       "-i|--input-format" and (at the moment) the input syntax is fixed.
208
209       The  general  format  is  "+-Nunit" where "+" or "-" is the sign, "N" a
210       number, and "unit" the unit as discussed below.
211
212       Units:
213         s  seconds
214         m  minutes
215         h  hours
216         rs real-life seconds, as in including leap  transitions
217
218         d  days
219         b  business days
220         mo months
221         y  years
222
223       For historical reasons, we used to accept "m" in the context  of  date-
224       only  input  as a qualifier for months.  As of 0.4.4, this is no longer
225       the case.
226
227

EXAMPLES

229         $ dateround 2012-03-01 2
230         2012-03-02
231         $
232
233         $ dateround -n 2012-03-01 1
234         2012-04-01
235         $
236
237         $ dateround 17:05:00 5m
238         17:05:00
239         $ dateround 17:04:00 /5m
240         17:05:00
241         $
242
243         $ dateround -n 17:04:00 4m
244         18:04:00
245         $ dateround -n 17:04:00 /1m
246         17:05:00
247         $
248

AUTHOR

250       Written by Sebastian Freundt <freundt@fresse.org>
251

REPORTING BUGS

253       Report bugs to: https://github.com/hroptatyr/dateutils/issues
254

SEE ALSO

256       The full documentation for dateround is maintained as a Texinfo manual.
257       If the info and dateround programs are properly installed at your site,
258       the command
259
260              info (dateutils)dateround
261
262       should give you access to the complete manual.
263
264
265
266dateutils 0.4.5                 September 2018                    DATEROUND(1)
Impressum