Your attributes are in reverse order.

It sohuld be datetime.strptime('1/1/18', format_string)

Minimal example:

from datetime import datetime as dt
dt.strptime('1/3/18','%m/%d/%y')

help() result on strptime:

Help on built-in function strptime:

strptime(…) string, format -> new datetime parsed from a string (like time.strptime()).

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top