Re: Converting epoch to timestamp

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Converting epoch to timestamp
Date: 2004-07-16 05:33:09
Message-ID: 9F8155C6-D6E9-11D8-BD2A-000A95C88220@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-16 05:49:27 Re: Very strange Error in Updates - At last resolved !
Previous Message lists 2004-07-16 05:32:01 XLogWrite: write request 0/53A4000 is past end of log 0/53A4000