Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: date minus one

Re: date minus one

From: Wolfgang Breitling <breitliw_at_centrexcc.com>
Date: Tue, 29 Mar 2005 12:29:29 -0700
Message-ID: <4249AC99.9050009@centrexcc.com>


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

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

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

-- 
Regards

Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Mar 29 2005 - 14:33:45 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US