[New-bugs-announce] [issue36759] datetime: astimezone() results in OSError: [Errno 22] Invalid argument

Snidhi Sofpro report at bugs.python.org
Tue Apr 30 07:36:26 EDT 2019


New submission from Snidhi Sofpro <Snidhi.Sofpro at gmail.com>:

With: Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32

import datetime;

d_Time = datetime.datetime.strptime('03:30 PM', '%I:%M %p');
d_Time = d_Time.astimezone(datetime.timezone.utc);
# RESULTS IN OSError: [Errno 22] Invalid argument

# WHEREAS the foll. does not have the issue!
d_Time = datetime.datetime(year    = d_Time.year,
                           month  = d_Time.month,
                           day     = d_Time.day,
                           hour    = d_Time.hour,
                           minute = d_Time.minute,
                           second  = d_Time.second,
                           tzinfo  = datetime.timezone.utc);

print(d_Time);

----------
components: Library (Lib)
messages: 341149
nosy: Snidhi
priority: normal
severity: normal
status: open
title: datetime: astimezone() results in OSError: [Errno 22] Invalid argument
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36759>
_______________________________________


More information about the New-bugs-announce mailing list