[issue39422] datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'

2020-01-22 Thread Cleland Loszewski


New submission from Cleland Loszewski :

```python
from datetime import datetime
print(datetime.strptime('2020016', '%Y%m%d'))
print(datetime.strptime('20200116', '%Y%m%d'))
```
The former string has a format that does not match '%Y%m%d', but the latter 
does.  Both report the same datatime output.

--
components: Library (Lib)
messages: 360480
nosy: losze1cj
priority: normal
severity: normal
status: open
title: datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'
type: behavior

___
Python tracker 
<https://bugs.python.org/issue39422>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39422] datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'

2020-01-22 Thread Cleland Loszewski


Cleland Loszewski  added the comment:

You're right, I did mean the second string to report '20200106'.  
Looking closer, I see that I was reading the documentation incorrectly and 
getting hung up on an introduced ambiguity.
```python
from datetime import datetime
print(datetime.strptime('2020016', '%Y%m%d'))
print(datetime.strptime('20200106', '%Y%m%d'))
print(datetime.strptime('202016', '%Y%m%d'))
print(datetime.strptime('2020106', '%Y%m%d'))
```

--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 
<https://bugs.python.org/issue39422>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com