Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Unix timestamp to timestamp without time zone

How do I convert a Unix timestamp (or epoch time) to a PostgreSQL timestamp without time zone?

For example, 1481294792 should convert to 2016-12-09 14:46:32.

I tried SELECT to_timestamp(1481294792)::timestamp, but that gives me 2016-12-09 09:46:32.

like image 839
ma11hew28 Avatar asked Dec 09 '16 20:12

ma11hew28


1 Answers

SELECT to_timestamp(1481294792) AT TIME ZONE 'UTC';

Source: https://dba.stackexchange.com/a/61345/33877

like image 144
ma11hew28 Avatar answered Oct 19 '22 03:10

ma11hew28