Re: Converting epoch to timestamp - Mailing list pgsql-hackers

From Michael Glaesemann
Subject Re: Converting epoch to timestamp
Date
Msg-id 9F8155C6-D6E9-11D8-BD2A-000A95C88220@myrealbox.com
Whole thread Raw
In response to Re: Converting epoch to timestamp  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Jul 16, 2004, at 1:55 PM, Tom Lane wrote:
> This is in fact wrong, unless you live in the British Isles: the
> result will be off by your timezone displacement from UTC.  Correct
> is to use timestamptz not timestamp.

Thanks. Timestamps and time zones are a challenge for me.

> A cast from integer is probably a bad idea, seeing that it will break 
> in
> 2038.  You could make an argument for a cast from double though.  The
> issue to my mind is whether this might be too Unix-centric.

In my mind, epoch is pretty Unix-centric. In IRC we often see people 
who want to store timestamps in their db as strings or integers, which 
we are sure to point out isn't necessarily the best way to take 
advantage of PostgreSQL's strengths in handling timestamps.

Having these (corrected) functions available would be enough in my 
mind. The casting idea came about when I was thinking about where I'd 
put the functions in the documentation.

Michael Glaesemann
grzm myrealbox com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Converting epoch to timestamp
Next
From: lists
Date:
Subject: XLogWrite: write request 0/53A4000 is past end of log 0/53A4000