问题
It is my understanding that EST, US/Eastern and America/New_York should be the same, but apparently I was wrong.
when I do the following:
pd.Timestamp('2011-07-03T07:00:00-04:00').tz_convert('US/Eastern')
which gave:
Timestamp('2011-07-03 07:00:00-0400', tz='US/Eastern')
when I do:
pd.Timestamp('2011-07-03T07:00:00-04:00').tz_convert('EST')
it gives:
Timestamp('2011-07-03 06:00:00-0500', tz='EST')
when I do:
pd.Timestamp('2011-07-03T07:00:00-40:00').tz_convert('America/New_York')
it gives:
Timestamp('2011-07-04 19:00:00-0400', tz='America/New_York')
could anyone give me some insight about this? I need to convert my timestamp so that it will be comparable with time for NYSE. Now I don't know which timezone to use. Thank you for your help.
There is a typo in my code (thanks, BrenBarn), so timezone: America/New_York and US/Eastern are actually the same.
回答1:
I believe during that season, the U.S. is in day light saving time. According to this website:
http://www.timeanddate.com/time/zones/est
U.S. use EST in winter and EDT in summer.
and
http://www.timeanddate.com/time/dst/2011.html
In 2011, day light saving starts from March 13th until November 6th.
回答2:
EST specifically refers to Eastern Standard Time, but the date you have chosen is during Daylight Savings Time.
Other than that, your examples will give the correct result if you use the same offset for all.  You're using -0400 in some but -4000 in others (maybe due to a typo).
来源:https://stackoverflow.com/questions/27183000/pandas-tz-convert-difference-among-est-us-eastern-and-america-new-york