From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Doug Silver <dsilver(at)urchin(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Converting epoc number to timestamp |
Date: | 2002-05-10 09:28:39 |
Message-ID: | 1021022919.2339.16.camel@linda |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Fri, 2002-05-10 at 01:26, Doug Silver wrote:
> Just curious if there's a way in Postgres to take an epoch number (UTC)
> which is stored as a bigint field and convert it to a timestamp.
>
> perl does it like so:
>
> $ perl -e 'print localtime(1020990264)."\n"'
> Thu May 9 17:24:02 2002
>
> Didn't see anything in the stored functions, but wanted to be sure. If
> not, would it make sense to create my own function that would do it in the
> database or just code it on the front end (i.e. web app)?
select 'epoch'::timestamp + '1020990264 seconds'::interval;
?column?
------------------------
2002-05-10 01:24:24+01
(1 row)
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
"My son, do not despise the LORD's discipline and do
not resent his rebuke, because the LORD disciplines
those he loves, as a father the son he delights in."
Proverbs 3:11,12
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew McMillan | 2002-05-10 13:57:10 | Re: Time Formatting |
Previous Message | hodges | 2002-05-10 03:30:17 | Re: Time Formatting |