pytz: Why is normalize needed when converting between timezones?

后端 未结 2 1055
执笔经年
执笔经年 2020-12-15 04:59

I\'m reading the not so complete pytz documentation and I\'m stuck on understand one part of it.

Converting between timezones also needs special atten

2条回答
  •  孤城傲影
    2020-12-15 05:40

    From the pytz documentation:

    In addition, if you perform date arithmetic on local times that cross DST boundaries, the results may be in an incorrect timezone (ie. subtract 1 minute from 2002-10-27 1:00 EST and you get 2002-10-27 0:59 EST instead of the correct 2002-10-27 1:59 EDT). A normalize() method is provided to correct this. Unfortunately these issues cannot be resolved without modifying the Python datetime implementation.

提交回复
热议问题