Converting postgres time zones

I’ve always found working with time zones to be a bit confusing. ┬áHere is a simple way to convert from UTC to any time zone.

Query without conversion:

select id, remote_ip, device_type, platform, created_at from visitors where autovist_url_id = 25032;

Query with conversion:

select id, remote_ip, device_type, platform, (created_at at time zone 'UTC') at time zone 'EST' as created_at from visitors where autovist_url_id = 25032;

Chris Downey

Founder, VaxCalc Labs and creator of Autovist and the Vaccine Ingredients Calculator.

Author: Chris Downey

Founder, VaxCalc Labs and creator of Autovist and the Vaccine Ingredients Calculator.

Leave a Reply

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