postgres=> SELECT EXTRACT(epoch FROM CAST('2017-12-06 00:17:10' AS TIMESTAMP)); date_part
------------
1512519430
(1 row)
postgres=> SELECT TO_TIMESTAMP(1512519430);
to_timestamp
------------------------
2017-12-06 08:17:10+08
(1 row)