Re: Date Math

From: Guy Fraser <guy(at)incentre(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Date Math
Date: 2003-07-09 22:35:13
Message-ID: 3F0C98A1.5030207@incentre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Or maybe you wanted :

update foo set abstime_field = abstime_field + '1 year'::reltime;

;^)

I normaly use 'abstime' and 'reltime' for dates and intervals, the major
difference is 'timestamp' has microsecond time accuracy, but abstime
takes less storage space IIRC.

Guy

Jean-Luc Lachance wrote:

>Try:
>
>update foo set timestamp_field = timestamp_field + '365
>days'::interval;
>
>
>John Goetsch wrote:
>
>
>>Hi,
>>
>>I am trying to modify some timestamps in the database and cannot find
>>documentation relating to date/timestamp manipulation.
>>
>>What I am thinking of something like:
>>
>>update foo set timestamp_field = timestamp_field + 365;
>>
>>where the 365 is days, or seconds or something.
>>
>>Any hints?
>>
>>Thanks
>>john
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>>
>>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Blüm 2003-07-09 22:45:23 IIRC + intervals + and other things
Previous Message Albert Cervera Areny 2003-07-09 19:44:36 INSERT but no UPDATE or DELETE from windows