RE: date minus one

  • From: "Reidy, Ron" <Ron.Reidy@xxxxxxxxxxxxxxxxxx>
  • To: <jknight@xxxxxxxxxxxxxx>, "oracle-l" <oracle-l@xxxxxxxxxxxxx>, "Thomas Jeff" <jeff.thomas@xxxxxxxxxxx>
  • Date: Tue, 29 Mar 2005 14:13:08 -0700

And therein lies the beauty of Perl - no messing/worry about the =
environment, portable to almost everywhere Oracle runs.

-----------------
Ron Reidy
Lead DBA
Array BioPharma, Inc.


-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Knight, Jon
Sent: Tuesday, March 29, 2005 1:37 PM
To: oracle-l; 'Thomas Jeff'
Subject: RE: date minus one


  Thanks for all the suggestions.

  I'm showing my ignorance here, but when using `TZ=3DGMT+24 date =
+"%Y%m%d"`,
is there any possibility of affecting other sessions connected as the =
same
user?  Or worse yet, does changing the TZ affect anything system wide?
Hopefully, it's only applicable to that one "date" call or session.

  I can just envision all the Oracle applications suddenly having wild =
and
varied date values.

Thanks,
Jon Knight

 -----Original Message-----
From:   Thomas Jeff [mailto:jeff.thomas@xxxxxxxxxxx]=20
Sent:   Tuesday, March 29, 2005 1:34 PM
To:     breitliw@xxxxxxxxxxxxx; jknight@xxxxxxxxxxxxxx
Cc:     oracle-l
Subject:        RE: date minus one

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

This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender  of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.

--
//www.freelists.org/webpage/oracle-l

Other related posts: