SQL – From timestamptz A to timestamptz B

For PostgreSQL (tested on 9.4)

CREATE TABLE tests(id serial not null, created_on timestamptz);
INSERT INTO tests (created_on) VALUES (now());
2016-02-16 19:26:13.823126-05

I guess you have configured your timezone in your postgresql.conf file. I have for information ‘America/Toronto’.

SELECT created_on  AT TIME ZONE ‘Europe/Paris’ FROM tests;
2016-02-17 01:26:13.823126

About Saïd

Software developer.

This entry was posted in Database, SQL. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *