tsdate [ parameter=value ]
Parameters are: output, std_format, base_year, days_since, date, minus_date.
tsdate is a tool intended for use in post-processing scripts. It can be used to compute the difference between two dates, or to convert from one date format to another. tsdate writes the result to UNIX stdout, which makes it easy to capture the result in a shell variable, e.g.,
set DIFF = `tsdate output=diff date=$PASSDATE minus_date=$ORBDATE`
The functionality of tsdate is best illustrated by example. In the following C-shell examples, date parameters are supplied explicitly; in a script, they normally would be supplied implicitly by variable.
Difference between two dates; date and minus_date can be expressed in either yy/mm/dd or yy.ddd:
% set DIFF = `tsdate output=diff date=96/09/25 minus_date=96/08/31`
% echo $DIFF
25
Convert date in (year, month, day) or (year, Julian day) to days since January 1, 1970, inclusive:
% set DAYS = `tsdate output=since base_year=1970 date=71/2/14`
% echo $DAYS
410
% set DAYS = `tsdate output=since base_year=1970 date=71.045`
% echo $DAYS
410
Convert days since January 1, 1970, inclusive, to (year, month, day) or (year, julian day):
% set YMD = (`tsdate output=yy_mm_dd std_format=no
base_year=1970 days_since=410`)
% echo $YMD[1] $YMD[2] $YMD[3]
71 02 14
% set YYDDD = (`tsdate output=yy_ddd std_format=no
base_year=1970 days_since=410`)
% echo $YYDDD[1] $YYDDD[2]
71 045
Convert (year, month, day) to/from (year, Julian day):
% set YYDDD = ( `tsdate output=yy_ddd std_format=yes date=71/02/14` )
% echo $YYDDD[1] $YYDDD[2]
71 045
% set YMD = ( `tsdate output=yy_mm_dd std_format=yes date=71.045` )
% echo $YMD[1] $YMD[2] $YMD[3]
71 02 14
Last Update: $Date: 2000/05/19 21:49:09 $