Re: Dateadd

Поиск
Список
Период
Сортировка
От Vivek Khera
Тема Re: Dateadd
Дата
Msg-id x78zkdgprh.fsf@yertle.kciLink.com
обсуждение исходный текст
Список pgsql-sql
>>>>> "LP" == Ligia Pimentel <lmpimentel@yahoo.com> writes:

LP> I need to know if there is a sql function implemented in postgres
LP> that gives me a date plus any number of days, months or years (the
LP> traditional dateadd function) or how to do it in sql?

Here's what I use:

select CURRENT_DATE + '4 DAYS'::interval;

Just cast your "interval" from a string to an interval type, then add
it to your date value.

I doubt this is portable.  What "tradition" provides for a dateadd()
function?


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/


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

Предыдущее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: How to encode and decode password in pgsql !!
Следующее
От: Jeff Self
Дата:
Сообщение: Re: "correct" sorting.