TimeZone Query: Time Difference between EST and UTC

4,741 views
Skip to first unread message

laxman.v...@gmail.com

unread,
Sep 29, 2016, 11:18:03 AM9/29/16
to golang-nuts
Hi,

Google shows difference between EST and UTC as 4 hours whereas go logic gives 5 hours difference in time.

https://play.golang.org/p/zHc9hM15iH

Is there any issue in my logic??

Thanks
LV

Andy Balholm

unread,
Sep 29, 2016, 12:12:13 PM9/29/16
to laxman.v...@gmail.com, golang-nuts
Right now there is a 4-hour difference between Eastern (Daylight) Time and UTC. But you asked for “EST”, and that is what you got: Eastern *Standard* Time. If you want a Location that automatically switches between EST and EDT, ask for “America/New_York”.

Andy

Adam Webb

unread,
Sep 29, 2016, 1:05:11 PM9/29/16
to golang-nuts, laxman.v...@gmail.com
Hi,

EST is 5 hours difference from UTC. 

However, most of those locations are currently using EDT which is 4 hours due to daylight savings. This is a common confusion of timezones so it depends on which one you mean. I live in a place that CST all year and doesn't do daylight savings time. 

Cheers,
Adam

laxman.v...@gmail.com

unread,
Sep 30, 2016, 3:48:16 AM9/30/16
to golang-nuts, laxman.v...@gmail.com
Thanks for the suggestions.

Yes during specific set of months, EST is considered as EDT due to daylight saving.
During EDT the difference is 4 hours and during EST the difference is 5 hours.

Using America/New_York instead of EST, gives the expected result as 4 hours.

I would like to give input as EST and map to America/New_York for LoadLocation, and get the output. Similarly for other timezones which has Daylight Savings.
This solves the issue I was trying, but like to know if there is any side effects due to this.
 Correct me if am wrong.

laxman.v...@gmail.com

unread,
Sep 30, 2016, 6:19:21 AM9/30/16
to golang-nuts, laxman.v...@gmail.com
Point 1:
Also can use "US/Eastern" for EST and "US/Pacific" for PST Instead of my previous statement "I would like to give input as EST and map to America/New_York for LoadLocation, and get the output. Similarly for other timezones which has Daylight Savings".
When used US/Eastern, difference with UTC show as 4 hours(since currently Eastern is under daylight)

Need confirmation if same input should give 5 hours after the daylight.
======================
Point 2:
I am not familiar with "time" libraries of other programming languages. When the time zone given is EST, library should ideally check the current System time and verify if it is in Daylight Saving OR Not Daylight Saving period and should provide the result accordingly. Please correct me if am wrong.


On Thursday, 29 September 2016 20:48:03 UTC+5:30, laxman.v...@gmail.com wrote:

Ian Lance Taylor

unread,
Sep 30, 2016, 9:06:07 AM9/30/16
to laxman.v...@gmail.com, golang-nuts
On Fri, Sep 30, 2016 at 3:19 AM, <laxman.v...@gmail.com> wrote:
>
> Point 2:
> I am not familiar with "time" libraries of other programming languages. When
> the time zone given is EST, library should ideally check the current System
> time and verify if it is in Daylight Saving OR Not Daylight Saving period
> and should provide the result accordingly. Please correct me if am wrong.

The Go library uses the timezone information from your system (on
Unix, in /usr/share/zoneinfo or some such place), so if your system
says that EST is always five hours from UTC, that is what you will
get. That is what the timezone database generally says: EST is always
five hours from UTC. On some systems, besides the choices you have
already found, you can use EST5EDT to get a timezone that pays
attention to daylight savings time.

Ian
Reply all
Reply to author
Forward
0 new messages