Re: Doing INTERVAL with NOW() versus casted timestamp
От
Tom Lane
Тема
Re: Doing INTERVAL with NOW() versus casted timestamp
Дата
Msg-id
10542.1361030953@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Doing INTERVAL with NOW() versus casted timestamp Wells Oliver <wellsoliver@gmail.com>
Re: Doing INTERVAL with NOW() versus casted timestamp Andreas Kretschmer <akretschmer@spamfence.net>
Re: Doing INTERVAL with NOW() versus casted timestamp John Shott <shott@stanford.edu>
Re: Doing INTERVAL with NOW() versus casted timestamp Tom Lane <tgl@sss.pgh.pa.us>
John Shott 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В списке pgsql-general по дате отправления