| From: | David Fetter <david(at)fetter(dot)org> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
| Subject: | Re: Small documentation patch |
| Date: | 2003-12-03 16:00:21 |
| Message-ID: | 20031203160021.GN9190@fetter.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
On Wed, Dec 03, 2003 at 10:49:01AM -0500, Tom Lane wrote:
>
> SELECT 'epoch'::timestamp + '1070430858 seconds'::interval;
>
> because it will produce a timestamp without time zone, thus
> effectively making the epoch be 1970-1-1 midnight local time. But
> of course the correct Unix epoch is 1970-1-1 midnight GMT. So
> correct code is
> SELECT 'epoch'::timestamptz + '1070430858 seconds'::interval;
>
> or you could use
>
> SELECT 'epoch'::timestamptz + 1070430858 * '1 second'::interval;
> which has the advantage that it works without weird concatenation
> pushups when the numeric value is coming from a variable.
Great! I am not attached to any particular way of doing this, just as
long as some clue about converting UNIX timestamps into PostgreSQL
timestamps gets in there :)
Cheers,
D
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 cell: +1 415 235 3778
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2003-12-03 22:40:09 | Re: introduce "default_use_oids" |
| Previous Message | Tom Lane | 2003-12-03 15:49:01 | Re: Small documentation patch |