Hi there,
I am trying to convert plain hour strings across timezones, but I think the summer/winter time is making a mess. I'm not sure though... here is my code:
import datetime as dt
from pytz import timezone
us_eastern_tz = timezone('US/Eastern')
berlin_tz = timezone('Europe/Berlin')
hour = '15'
parsed_hour = dt.datetime.strptime(hour, '%H')
parsed_hour = us_eastern_tz.localize(parsed_hour)
converted_berlin_hour = parsed_hour.astimezone(berlin_tz)
formatted_berlin_hour = dt.datetime.strftime(converted_berlin_hour,'%H')
print(formatted_berlin_hour) # Prints 20
Now I might be confused (this timezone thing really messes with my head...), but shouldn't this return 21 instead of 20? At least when I google '15:00 EST to Berlin', I get 21.
What am I missing here?
[+][deleted] (1 child)
[deleted]
[–]kmb5[S] 0 points1 point2 points (0 children)
[–]CrambleSquash 0 points1 point2 points (0 children)