Home > Archive > PostgreSQL Newbies > May 2005 > convert from epoch to timestamp









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author convert from epoch to timestamp
Celia McInnis

2005-05-06, 8:24 pm

This time I'll give an appropriate subject...

How to I convert from EPOCH time to a "TIMESTAMP WTHOUT TIME ZONE" type?

Celia McInnis
(who's tired and wants to go home...)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Bruno Wolff III

2005-05-09, 8:24 pm

On Fri, May 06, 2005 at 19:39:26 -0500,
Celia McInnis <celia@drmath.ca> wrote:
> This time I'll give an appropriate subject...


Please don't reply to existing threads to start a new one, even if you change
the subject.

> How to I convert from EPOCH time to a "TIMESTAMP WTHOUT TIME ZONE" type?


The simplest is probably:
select 1::abstime at time zone 'UTC';
Where you replace '1' by whatever number has the integer number of seconds
since the epoch. If you need fractional seconds then you need to multiply
the number seonds times and interval of 1 second and add it to the
the start of the epoch.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com