"yesterdate" function?
Jean-Pierre Radley
jpr at dasys1.UUCP
Sat Jan 14 08:20:23 AEST 1989
In article <19100001 at hpficad.HP.COM> mcr at hpficad.HP.COM (Matt Reprogle) writes:
>I need a way to get yesterday's date in YYMMDD format in a Unix script and put
>it in a file. I don't want to write a C program implementing an entire
>calendar to do it.
The C program exists: "datecalc", written by Fred Buck, and available
in the LIBraries of the TANGENT Forum on Compuserve. It'll solve that
problem, and do dozens of other little date routines. Anyone not on CIS,
E-mail me.
But to just solve the one little problem posed by Matt:
GMTDIFF=`echo $TZ | sed 's/[^0-9]*//g'`
YESTGMTDIFF=`expr $GMTDIFF + 24`
TZY=`echo $TZ | sed 's/[0-9][0-9]*/'$YESTGMTDIFF'/'`
YESTERDATE=`TZ=$TZY date +%y%m%d`
--
Jean-Pierre Radley Honi soit jpr at dasys1.UUCP
New York, New York qui mal ...!hombre!jpradley!jpr
CIS: 76120,1341 y pense ...!hombre!trigere!jpr
More information about the Comp.unix.questions
mailing list