AttributeError: module object has no attribute strptime

41

Use this: from datetime import datetime
instead of Import datetime
# import datetime module
import datetime

start_date = "2022-05-06"

# convert into datetime object and print
print(datetime.datetime.strptime(start_date, "%Y-%m-%d"))

Comments

Submit
0 Comments