Search Postgresql Archives

Re: Doing INTERVAL with NOW() versus casted timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Shott <shott@xxxxxxxxxxxx> writes:
> I believe that if you use the current_date function, instead of now(), 
> and subtract 24 hours from that, then you will get the behavior that you 
> expect.

If you're working with dates, rather than timestamps, it's even easier
than that: just add or subtract an integer.

regression=# select current_date;
    date    
------------
 2013-02-16
(1 row)

regression=# select current_date - 1;
  ?column?  
------------
 2013-02-15
(1 row)

			regards, tom lane


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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux