I have a table which has:
- Source date column
- Source timestamp (30 minute interval, a string)
- The datetime UTC timestamptz column
The 'reporting' time zone (how the time zone should be displayed eventually)
date interval datetime_utc time_zone2018-05-11 22:30 2018-05-10 03:30:00 America/New_York
Is there an efficient way to convert the datetime_utc column to the time zone indicated in the same row within a query or a view? I was able to do this using Python, but I would like to know how to do it directly in my query.
This seems to work - I am able to refer to the column name and it converts it accurately based on the value found in that row.
(interval_timestamp_utc :: TIMESTAMPTZ AT TIME ZONE time_zone) :: DATE AS "Reporting Date",
to_char((interval_timestamp_utc :: TIMESTAMPTZ AT TIME ZONE time_zone), 'HH24:MI') AS "Reporting Interval",
select '2018-05-10 03:30:00'::timestamp at time zone 'America/New_York';? Look alsopg_catalog.pg_timezone_abbrevsandpg_catalog.pg_timezone_namestables. - Abelisto