datecalc - compute with times
datecalc [-v] [-o format] -a date time
datecalc [-v] -c date date
datecalc [-v] -c time time
datecalc [-v] -d time scalar
datecalc [-v] [-o format] -e scalar
datecalc [-v] [-o format] -f date
datecalc [-v] -m time scalar
datecalc [-v] -n time
datecalc [-v] [-o format] -p date
datecalc [-v] [-o format] -s date time
datecalc [-v] -t date
datecalc [-v] -y time
Datecalc outputs a value computed from the command line expression.
There are three different specifications allowed in an expression:
A date is either the output of the date(1) command, or one of
the words now, today, yesterday, or tomorrow. Some other repre-
sentations of a date are parsed: all of them must be contained
in a single shell word. For example ctime(3) output is a valid
A timeu is an integer number followed by a unit. Units are
hours, minutes, days, weeks, fortnights, years, or leapyears and
may be abbreviated to their first letter. A time can be fol-
lowed by another time, as a shell word; the result is the sum of
the times (e.g. "2y1w" is 2 years 1 week).
A scaler is an integer with no time unit on the end.
In addition to these types the output may simply be an exit code (0 for
success, 1 for failure).
Add a time to a date [to get a date].
Compare two dates or times [to get an exit code].
Divide a time by a scalar [to get a time].
Convert seconds since the epoch to a date.
Convert a free format date to fixed format date.
Print only a brief help message.
Multiply a time by a scalar [to get a time].
Convert a time to scalar seconds.
Specify the output format for any computed date (as per strf-
Convert a date to scalar seconds since the epoch.
Subtract a time from a date [to get a date].
Convert a free format date to at(1) format.
Be verbose by announcing what operation we are about to do.
Show only the standerd version banner.
Convert a time to years days hours minutes seconds [to get a
time with units as English words].
datecalc -o %Y -a 1d "'date'"
Output tomorrow's year.
datecalc -o %Y tomorrow
Output tomorrow's year, a little faster.
Output what date(1) might have output yesterday.
datecalc "15 Feb 2009"
Output the given date in the standard format.
datecalc -y "2y1l2f6h"
Output "3 Years 29 Days 6 Hours", which is more legible, and
more accurate than "3 years 1 month".
Poorly documented (to say the least). Infix or prefix command line
options would be far more useful.
It usually takes more than one datecalc command to get what you want.
Mike MacKenzie and KS Braunsdorf
NPC Guild UNIX Support, rpm at ksb.npcguild.org.nospam
sh(1), strftime(3), at(1), date(1), ctime(3)