DTEST(1) User Commands DTEST(1)NAMEdtest - Compare dates or times
SYNOPSISdtest [OPTION]... DATE/TIME1 OP DATE/TIME2
DESCRIPTIONdtest 0.2.7
Like test(1) but for dates.
-h, --help
Print help and exit
-V, --version
Print version and exit
-q, --quiet
Suppress message about date/time and duration parser errors.
-i, --input-format=STRING
Input format, can be used multiple times. Each date/time will
be passed to the input format parsers in the order they are
given, if a date/time can be read successfully with a given
input format specifier string, that value will be used.
-e, --backslash-escapes
Enable interpretation of backslash escapes in the output and
input format specifier strings.
Group: op
Following operations are supported
--eq DATE/TIME1 is the same as DATE/TIME2
--ne DATE/TIME1 is not the same as DATE/TIME2
--gt DATE/TIME1 is newer than DATE/TIME2
--lt DATE/TIME1 is older than DATE/TIME2
--ge DATE/TIME1 is newer than or equals DATE/TIME2
--le DATE/TIME1 is older than or equals DATE/TIME2
--nt DATE/TIME1 is newer than DATE/TIME2
--ot DATE/TIME1 is older than DATE/TIME2
--cmp compare DATE/TIME1 to DATE/TIME2, return with 0 if equal, 1 if
left argument was newer and 2 if right argument was newer
EXAMPLES
$ dtest 2012-03-01 --gt 2012-03-02 || echo "false"
false
$
$ dtest 2012-03-01 --ot 2012-03-02 && echo "true"
true
$
$ dtest 2012-03-01 --cmp 2012-03-02; echo $?
2
$
$ dtest 2012-03-02 --cmp 2012-03-02; echo $?
0
$
$ dtest 2012-03-02 --cmp 2012-03-01; echo $?
1
$
$ dtest 12:00:04 --gt 11:22:33 && echo "true"
true
$
$ dtest 12:00:04 --lt 11:22:33 || echo "false"
false
$
$ dtest 12:00:04 --cmp 11:22:33; echo "$@{?@}"
1
$
$ dtest--cmp 11:22:33 12:00:04; echo "$@{?@}"
2
$
$ dtest--ne 2012-03-02T00:00:00 2012-03-02 || echo 'false'
false
$
$ dtest 2012-03-02T09:00:00 --ot 2012-03-02T10:00:00 && echo "true"
true
$
$ dtest 2012-03-02T07:00:00 --cmp 2012-03-02T09:30:00; echo "$@{?@}"
2
$
$ dtest--cmp 2012-03-02T12:00:00 2012-03-02T09:30:00; echo "$@{?@}"
1
$
$ dtest 2012-03-02T07:00:00 --cmp 09:30:00; echo "$@{?@}"
3
$
AUTHOR
Written by Sebastian Freundt <freundt@fresse.org>
REPORTING BUGS
Report bugs to: https://github.com/hroptatyr/dateutils/issues
SEE ALSO
The full documentation for dtest is maintained as a Texinfo manual. If
the info and dtest programs are properly installed at your site, the
command
info (dateutils)dtest
should give you access to the complete manual.
dateutils 0.2.7 January 2014 DTEST(1)