r.date
r.date prints on standard output the difference between 2  (CMC) timestamps (in hours by default) or, if it is given one date and a negative/positive offset (in hours by default), it will return the resulting date. If the r.date receives no arguments or incorrect arguments, it will give comments on how to use it. You have an option of adding a newline (end of line) at the end of the result.
Usage  (version 1.0.4)
r.date[-nVSL] date1   (timestamp conversion)

r.date[-nVSLpPMM] [C print format] date1 date2     (time difference)

r.date[-nVSL] date1 +/-nhours  (add +-nhours to a timestamp)

Description
[-nVSLpPMM] (optional)
-n newline character will be added to the result
-V output in format YYYYMMDDHHmmss00
-S output in 9-digit CMC timestamp format
-L output in format YYYY MM DD HH mm ss

-M multiply result by 60 (time difference in minutes)

-MM multiply result by 3600 (time difference in seconds)

-p time difference (hours,minutes,seconds) will be printed using C print format supplied

-P same as p, using fixed format giving HHHMMSS    (format = "%03d%02d%02d")

default
output format YYYYMMDDHHmmss00 if date1 is given in format CMC timestamp

output in format CMC timestamp if date1 is given in format YYYYMMDD[HHmmss00]

date1/date2
CMC timestamp format ie: 031398160 (internal integer number)
runid ie: OPRUN,NOW,SPRO2,G100...(defined by operations)
YYYYMMDD[HH][mm][ss][hh]
YYYY year

MM month

DD day

HH hour (optional)

mm minute (optional)

ss second (optional)

hh hundredths of a second (optional)

+/-nnn[SMDW]
Subtract or add "nnn" (hours by default) to date1.

nnnS (in seconds)

nnnM (in minutes)

nnnD (in days)

nnnW (in weeks)

Examples
1) Difference between two given dates.
pollux% r.date -n 19961225 199612161548

200.199997

pollux%

2) Offset added to  a given date with no newline character after.
pollux% r.date 19961225 -200

1996121616000000pollux%

3) Offset  in seconds added to a "runid" (printed in "exploded" format).
pollux% r.date -L OPRUN +1000S

1998 03 13 16 16 40pollux%

4) Difference of 20 seconds (answer  in hours by default)
pollux% r.date 1998031316164000 1998031316162000

0.00555556pollux%

Author: Simon Pellerin (ARMA), Michel Valin (ARMN)