[SunHELP] Solaris10 date calculation not working?
Sandwich Maker
adh at an.bradford.ma.us
Sun Oct 11 22:35:05 CDT 2009
" From: stephen price <sd_price at yahoo.com>
"
" I'm trying to do a simple "what date is yesterday" shell script variable - without having to go to perl or something else.
"
" []
" yesterday2=`TZ=CST6CDT+24 date +%Y%m%d%H%M`
"
" []
"
" Why is it only 19 hours back instead of the 24 hours ?
try adding the 24 to the 6 algebraically instead of string concat, eg.
TZ=CST30CDT date
" 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 ...
i've been doing the above since 2.4. in fact, i've used some rather
large numbers for the tz offset...
how about
typeset -i NODAYS=0 # no. of days into past, init none.
.
.
# set NODAYS
.
.
TZ=CST$((6+(24*NODAYS)))CDT
date
________________________________________________________________________
Andrew Hay the genius nature
internet rambler is to see what all have seen
adh at an.bradford.ma.us and think what none thought
More information about the SunHELP
mailing list