New submission from Raghunath Lingutla <raghunath.lingu...@gmail.com>:

Can not recognize invalid date values for %Y%m%d, %y%m%d, %Y%m%d %H:%M and few 
more formats. In Java we have setLenient option which help us to validate to 
pattern and convert only valid formats
Ex: datetime.strptime('181223', '%Y%m%d') 
For above input I am getting output as 1812-02-03 00:00:00 but expected output 
is error as ValueError: time data '181223' does not match format '%Y%m%d'

I tested below mentioned 4 modules. All modules giving same output

1) datetime.strptime

2) timestring.Date

3) parser.parse from dateutil

4) dateparser.parse

----------
components: Tests
messages: 320233
nosy: Raghunath Lingutla
priority: normal
severity: normal
status: open
title: datetime.strptime not able to recognize invalid date formats
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33941>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to