RE: date minus one

  • From: "Thomas Jeff" <jeff.thomas@xxxxxxxxxxx>
  • To: <breitliw@xxxxxxxxxxxxx>, <jknight@xxxxxxxxxxxxxx>
  • Date: Tue, 29 Mar 2005 14:33:35 -0500

That's exactly what I do, e.g:

export YESTERDAY=3D`TZ=3DGMT+24 date +"%Y%m%d"`  =20

$ TZ=3DGMT+24 date +"%Y%m%d"
20050328                        =20


-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Wolfgang Breitling
Sent: Tuesday, March 29, 2005 2:29 PM
To: jknight@xxxxxxxxxxxxxx
Cc: oracle-l
Subject: Re: date minus one


One trick is to temporarily advance the TZ to a time zone further west,=20
get your date, and then reset TZ again:

$ echo $TZ
MST7MDT
$ date +"%Y-%m-%d"
2005-03-29
$ TZ=3DMST22MDT
$ date +"%Y-%m-%d"
2005-03-28
$ TZ=3DMST7MDT
$

Knight, Jon wrote:
>   Just curious how the rest of the world gets "yesterday" in UNIX. =20
> We're running Solaris and we execute a sqlplus script with "select=20
> sysdate-1 from dual;" and pipe it to tail to set an environment=20
> variable.
>=20
>   Is there a more UNIXy way, -or- maybe a java function.  Any=20
> suggestions welcome.
>=20
> TIA,
> Jon Knight
>=20
> --
> //www.freelists.org/webpage/oracle-l
>=20

--=20
Regards

Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com
--
//www.freelists.org/webpage/oracle-l
--
//www.freelists.org/webpage/oracle-l

Other related posts: