[SunHELP] Solaris10 date calculation not working?

stephen price sd_price at yahoo.com
Sun Oct 11 21:08:07 CDT 2009


I'm trying to do a simple "what date is yesterday" shell script variable - without having to go to perl or something else.

# todays date & time
d1=`date +%Y%m%d%H%M`
echo $d1
#yesterdays date & time - should be 24 hours back
yesterday1=`TZ=US/Central+24 date +%Y%m%d%H%M`
yesterday2=`TZ=CST6CDT+24 date +%Y%m%d%H%M`
yesterday3=`TZ=America/Chicago+24 date +%Y%m%d%H%M`
echo
echo $yesterday1
echo $yesterday2
echo $yesterday3


200910111937

200910110037
200910110037
200910110037

Why is it only 19 hours back instead of the 24 hours ?
I tried ksh & sh & bash - just in case korn wasn't handling correctly - but still got the same output.
I'm sure I'm missing something simple - 
Any suggestions welcome ...

steve



More information about the SunHELP mailing list