INSERT INTO timestamp_demo (ts, tstz)
VALUES('2016-06-22 19:10:25-07','2016-06-22 19:10:25-07');
Code language: SQL (Structured Query Language) (sql)
(now())::timestamp(0))
CREATE TABLE timestamp_demo (
ts TIMESTAMP,
tstz TIMESTAMPTZ
);
Code language: SQL (Structured Query Language) (sql)
ts | tstz
---------------------+------------------------
2016-06-22 19:10:25 | 2016-06-22 19:10:25-07
(1 row)
Code language: SQL (Structured Query Language) (sql)
SET timezone = 'America/Los_Angeles';
Code language: SQL (Structured Query Language) (sql)
TimeZone
---------------------
America/Los_Angeles
(1 row)
Code language: SQL (Structured Query Language) (sql)
SHOW TIMEZONE;
Code language: SQL (Structured Query Language) (sql)
SELECT
ts, tstz
FROM
timestamp_demo;
Code language: SQL (Structured Query Language) (sql)
SET timezone = 'America/New_York';
Code language: SQL (Structured Query Language) (sql)
SELECT
ts,
tstz
FROM
timestamp_demo;
Code language: SQL (Structured Query Language) (sql)
ts | tstz
---------------------+------------------------
2016-06-22 19:10:25 | 2016-06-22 22:10:25-04
(1 row)
Code language: SQL (Structured Query Language) (sql)