Re: [SQL] Date question

Поиск
Список
Период
Сортировка
От clayton cottingham
Тема Re: [SQL] Date question
Дата
Msg-id 3AA54A87.EFA4EDAE@smartt.com
обсуждение исходный текст
Ответ на RE: [SQL] Date question  ("Francis Solomon" <francis@stellison.co.uk>)
Список pgsql-general
Francis Solomon wrote:
>
> Hi Boulat,
>
> stasis=# select (now() + '1 year')::date;
>   ?column?
> ------------
>  2002-03-06
> (1 row)
>
> Hope this helps
>
> Francis
>
> > Hi,
> >
> > Im a little bit stuck here.
> >
> > Does anyone know how to get date in format 'YYYY-MM-DD' of a date one
> > year from now.
> > So for example today is '2001-03-06' I need to get date 12 months from
> > now
> > which will be '2002-03-06' in todays case...
> >
> > In mysql I used  DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that
> > doesnt work in PG.
> >
> >
> > Regards,
> > Boulat Khakimov
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


i dunno about you but i like this syntax better than the old :: ones

select date(now()+ '1 year');

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

Предыдущее
От: Aristide Aragon
Дата:
Сообщение: varchat ->text
Следующее
От: Richard Huxton
Дата:
Сообщение: CONTRIB: int8 sequence simulator