Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (38 sloc) 1.55 kb
args "--unamed-opts --long-help"
package "dround"
usage "dround [OPTION]... [DT_ARG] RNDSPEC..."
description "Round DT_ARG to the next occurrence of RNDSPEC.
If DT_ARG is omitted a stream of DT_STR{}s is read from stdin.
RNDSPECs can be month names (Jan, Feb, ...), weekday names (Sun, Mon, \
...), or days.
If a month name the next DT_STR relative to DT_ARG is returned whose \
month part matches the value given, so e.`g. dround 2012-01-01 Feb' \
will return 2012-02-01.
If a weekday name is given, the next DT_STR after DT_ARG whose weekday \
part matches the values given is returned.
If a day, the next DT_STR after DT_ARG whose day part matches is \
returned, so `dround 2012-01-15 1' will return 2012-02-01.
RNDSPECs can also be multiples of the day dividing units, e.g 1h rounds \
to the nearest full hour, 30m to the nearest half hour, and 10s to the \
next 10s mark.
To round to the previous occurrence of a RNDSPEC any argument can be \
prefixed with a `-' to denote that. E.g. `dround 2012-02-14 -1' will \
return 2012-02-01. And `dround 2012-02-11 -- -Sep' will return \
Multiple RNDSPECs are evaluated left to right.
Note that rounding isn't commutative, e.g.
2012-03-01 Sat Sep -> 2012-09-03
2012-03-01 Sep Sat -> 2012-09-01
Note that non-numeric strings prefixed with a `-' conflict with the \
command line options and a separating `--' has to be used."
option "next" n
"Always round to a different date or time."
Jump to Line
Something went wrong with that request. Please try again.