Re: quick way to get yesterdays date

From: Coyle, Jack (Jack.Coyle@REXHEALTH.COM)
Date: Tue Aug 05 2003 - 11:25:33 EDT


Shawn,

Try including the following line in your script

typeset -Z2 DDATE

followed by the lines you have shown. Be advised, however, that if you
should pass this value to a sub-routine, the receiving variable in the
sub-routine should also include the typeset specification to avoid the
leading zero truncation.

Regards,

Jack Coyle
Rex Healthcare
(919) 784-3792
jack.coyle@rexhealth.com

> ----------
> From: Shawn Bierman[SMTP:BiermanS@METHODISTHEALTH.ORG]
> Reply To: IBM AIX Discussion List
> Sent: Tuesday, August 05, 2003 11:08 AM
> To: aix-l@Princeton.EDU
> Subject: quick way to get yesterdays date
>
> I tried something like this but if todays date is 05 it will return 4
> instead of 04. Is there an existing method for doing this that I have
> overlooked?
>
>
> DDATE=`date +%d`
> DDATE=$((${DDATE} - 1))
> echo ${DDATE}
>



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:07 EDT