On 2009-10-14, Shruthi A <shruthi.i...@gmail.com> wrote:
> --0016e64698e4af821f0475e1f43d
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> I'm using Enterprise DB PostgresPlus version 8.3.
> Is there is a simple function or command like previous_date(mydate) which
> when passed a particular date, simply returns the previous date? I tried
>
> mydate - 1
>
> but this doesnt work.

it should, if mydate is a date variable.

if it's some sort of timestamp more care is needed

 mytimestamp - interval'1 day'
 
also don't use interval'24h' unless you want 24h, because not all days are 24h

 select timestamptz'2009-09-28 00:30' - interval'24 h' ;
         ?column?        
         ------------------------
          2009-09-26 23:30:00+12
          
 (the interval crosses the local start of DST)
 
 

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to