12
- The current date. dateutil
accepts components from the current date / time to account for the missing date or year in the date (this is not done for the month, only the date or year). As in another example, it will be a date - Janauary 20
- it will be analyzed as 2015/01/12
taking 2015 from the current time and time.
, - , .
, datetime, , datetime.datetime.strptime , ValueError. -
def isdate(dt, fmt):
try:
datetime.datetime.strptime(dt, fmt)
return True
except ValueError:
return False
validformats = [...]
dates =[...]
for x in dates:
if any(isdate(x,fmt) for fmt in validformats):
print(x, 'is valid date')