8

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.

ma11hew28
  • 121,420
  • 116
  • 450
  • 651

1 Answers1

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

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

Community
  • 1
  • 1
ma11hew28
  • 121,420
  • 116
  • 450
  • 651