The current way of parsing dates ignores timezone information. Using email.utils.parsedate_to_datetime is simpler and preserves the timezone. Also time.mktime's argument is the time in local time, which is not what email.utils.parsedate returns because it simply ignores timezone data in the date string.
The current way of parsing dates ignores timezone information. Using
email.utils.parsedate_to_datetime
is simpler and preserves the timezone. Alsotime.mktime
's argument is the time in local time, which is not whatemail.utils.parsedate
returns because it simply ignores timezone data in the date string.