1
votes

I am having datetime in csv file in UTC tmezone, if i convert it from UTC to pytz.timezone('America/Los_Angeles') or any other America timezone it will omit the 2nd hour(2:MM:SS) from DST(Daylight savings time). Ex: 2019-03-10 00:00:00

directly goes to 1st hour(1:MM:SS) to 3rd hour(3:MM:SS). If i plot line chart using converted datetime in C3(javascript chart library), there is an one hour gap between 1st and 3rd hour.

Note: 2nd hour data was missed while converting UTC to 'America/Los_Angeles' because of DST.

is there any way to parse datetime without missing 2nd hour data?

1
just plot UTC time (which increases monotonically at a constant rate). Unfortunately, there is no formatting option (that I know of) to account for local time, which would basically only have to adjust the labels to show local time instead of UTC.MrFuppes

1 Answers

0
votes

Welcome to the stupidity that is Daylight Saving Time. In North America, there are 2 clock change days: "spring forward" in March and "fall back" in November. The exact days are different every year.

  • On the "spring forward" day, the clocks jumps from 1:59:59 to 3:00:00 - there's no 2AM.
  • Conversely, on "fall back" day, 1:59:59 is followed by another 1:00:00 - so there are two 1AMs.

pytz is doing the right thing, only the human behaviors that are so perplexing.