How can I find out if local time is missing? I try with pytz, but it throws an AmbiguousTimeError, not a NonExistentTimeError.
2013-3-31 02:30 will never happen in Copenhagen due to daylight saving time.
local_tz = timezone('Europe/Copenhagen') try: non_e = local_tz.localize(datetime.datetime(2013, 3, 31, 2, 30), is_dst = None) except pytz.AmbiguousTimeError: print "AmbiguousTimeError"
It goes to the exception handler. I tried:
except pytz.NonExistentTimeError:
The user provides me with the date and time through the form. This is local time, and I need to find out if the dates and time match.
I use Django with USE_TZ = True , but I don't think that matters.
user984003
source share