Answers for "strftime strptime"

0

strptime

import datetime

date = '2021-01-01'
# For a datetime.datetime obj:
datetime.datetime.strptime(date, '%Y-%m-%d')
# For a datetime.date obj:
datetime.datetime.strptime(date, '%Y-%m-%d').date()
Posted by: Guest on September-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language