Date Math
Date Math
От:
John Goetsch <jg@seacode.com>
Дата:
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
Re: Date Math
От:
Jean-Luc Lachance <jllachan@nsd.ca>
Дата:
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@postgresql.org
Re: Date Math
От:
Guy Fraser <guy@incentre.net>
Дата:
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@postgresql.org >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > > >