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

From Christopher Kings-Lynne
Subject Re: Converting epoch to timestamp
Date
Msg-id 40F763C4.7060003@familyhealth.com.au
Whole thread Raw
In response to Re: Converting epoch to timestamp  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Converting epoch to timestamp  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> 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.
> 
> As an example: timestamp 1089953023 equates to Fri Jul 16 2004, 00:43:43 EDT
> according to strftime() on my machine (I live in US Eastern zone which
> is presently GMT-4).  I get

I would actually prefer this syntax:

SELECT EXTRACT(EPOCH FROM TIMESTAMP '2003-01-01 11:23:44');

Chris



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [pgsql-hackers-win32] Weird new time zone
Next
From: Justin Clift
Date:
Subject: Re: pg_dump - option for just dumping sequences?