Re: quick way to get yesterdays date

From: Green, Simon (Simon.Green@EU.ALTRIA.COM)
Date: Tue Aug 05 2003 - 11:44:57 EDT


The best way I know of is to use the TZ environment variable. It's been
discussed numerous times here before, but here's an example.

>echo TZ
NFT-1DFT,M3.5.0/02:00:00,M10.5.0/03:00:00
>date +%d
05
>ksh TZ=NFT23DFT,M3.5.0/02:00:00,M10.5.0/03:00:00 date +%d
04

Depending on what you're doing, you may choose to leave off the specific
hour from the TZ. You could also do export TZ=NFS23DFT rather than start a
new shell, if you prefer.

Simon Green
Altria ITSC Europe Ltd

AIX-L Archive at http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
AIX FAQ at http://www.faqs.org/faqs/aix-faq/

N.B. Unsolicited email from vendors will not be appreciated.

> -----Original Message-----
> From: Shawn Bierman [mailto:BiermanS@METHODISTHEALTH.ORG]
> Sent: 05 August 2003 16:09
> 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