Re: Converting epoch to timestamp?
От | Richard Huxton |
---|---|
Тема | Re: Converting epoch to timestamp? |
Дата | |
Msg-id | 001b01c11a63$f86779e0$1001a8c0@archonet.com обсуждение исходный текст |
Ответ на | Converting epoch to timestamp? (Roberto Mello <rmello@cc.usu.edu>) |
Ответы |
Re: Converting epoch to timestamp?
Re: Converting epoch to timestamp? |
Список | pgsql-sql |
From: "Roberto Mello" <rmello@cc.usu.edu> Hi Roberto - long time no see. > I searched the docs for function to convert epoch to timestamps but > couldn't find any. Are there any? richardh=> select now(); now ------------------------2001-08-01 09:25:58+01 (1 row) richardh=> select extract('epoch' from now());date_part -----------996654359 (1 row) richardh=> select '1970-01-01'::date + '996654342 seconds'::interval; ?column? ------------------------2001-08-01 08:25:42+01 (1 row) That's the only way I've ever known to do it. Note the one-hour offset because I'm currently in BST rather than GMT timezone (ignore the few seconds discrepancy - that's me querying then cutting and pasting). Be interested to find out if there's a neater way. Can't believe there's not some EPOCH_BASE constant that could be used. - Richard Huxton
В списке pgsql-sql по дате отправления: