Is this a bug? I'm trying to convert a UTC date to my local time zone (EST).
The getdate() function returns the correct date and time, and the getutcdate() function returns the correct UTC date and time, but when I use the AT TIME ZONE feature to convert the UTC time to EST (my local time zone) and cast the result to date time the result is one hour off...
Code: Select all
dbadmin=> show time zone;
name | setting
----------+------------
timezone | US/Eastern
(1 row)
Code: Select all
dbadmin=> SELECT getdate(), getutcdate(), cast(getutcdate() at time zone 'EST' as datetime) utc_to_est;
getdate | getutcdate | utc_to_est
----------------------------+----------------------------+----------------------------
2012-10-04 10:19:36.827054 | 2012-10-04 14:19:36.827054 | 2012-10-04 15:19:36.827054
(1 row)
Time: First fetch (1 row): 7.747 ms. All rows formatted: 7.781 ms
I'm confused.
Thanks!