Re: How to get the previous date?

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: How to get the previous date?
Дата
Msg-id hbcahr$k31$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на How to get the previous date?  (Shruthi A <shruthi.iisc@gmail.com>)
Список pgsql-sql
On 2009-10-14, Shruthi A <shruthi.iisc@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)
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: Efficiency in Multiple Queries of Same Table in a PL/PgSQL Function
Следующее
От: Thom Brown
Дата:
Сообщение: Re: Lag and lead window functions order by weirdness