PostgreSQL: remove time zone from unix time stamp with time zone

Trabla: remove time zone from unix time stamp with time zone

1396003662  ->  "2014-03-28 12:47:42+02"  time zone +2 hours

Solving:

SELECT 
        1396003662 AS unixtime_with_timezone
    ,    to_timestamp( 1396003662 ) AS timestamp
    ,    extract ( epoch from ( to_timestamp ( 1396003662 ) - (SELECT age(now() at time zone 'UTC', now())) ) ) AS unixtimestamp_without_timezone




PostgreSQL database howto remove time zone from unix timestamp with time zone - codingtrabla tutorial screenshot 1

No comments:

Post a Comment