Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created September 13, 2013 18:06
Show Gist options
  • Save davetapley/6554061 to your computer and use it in GitHub Desktop.
Save davetapley/6554061 to your computer and use it in GitHub Desktop.
Local time
SELECT start_time, time_zone, start_time + (time_zone * INTERVAL '1 second') AS start_time_local FROM events LIMIT 1;
start_time | time_zone | start_time_local
-----------------------+-----------+-----------------------
2012-10-25 11:53:37.5 | -14400 | 2012-10-25 07:53:37.5
@davetapley
Copy link
Author

This gets very silly when we have multiple instances of start_time + (time_zone * INTERVAL '1 second') type expressions, usually wrapped with an EXTRACT, all over the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment