Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: date minus one
And therein lies the beauty of Perl - no messing/worry about the =
environment, portable to almost everywhere Oracle runs.
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]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_at_thomson.net]=20 Sent: Tuesday, March 29, 2005 1:34 PM To: breitliw_at_centrexcc.com; jknight_at_concordefs.com 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_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Wolfgang Breitling
Sent: Tuesday, March 29, 2005 2:29 PM
To: jknight_at_concordefs.com
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 > -- > http://www.freelists.org/webpage/oracle-l >=20
--=20
Regards
Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com
-- http://www.freelists.org/webpage/oracle-l -- http://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. -- http://www.freelists.org/webpage/oracle-lReceived on Tue Mar 29 2005 - 16:15:22 CST
![]() |
![]() |