-2

Can someone help me in parsing the date like this to datetime format

'Oct. 1, 2020'

Thanks

Amiclone
  • 388
  • 2
  • 11

1 Answers1

1

This should do:

from datetime import datetime

my_date = 'Oct. 1, 2020'

my_date_object = datetime.strptime(my_date, '%b. %d, %Y')

print(my_date_object)  # datetime.datetime(2020, 10, 1, 0, 0)
F.NiX
  • 1,457
  • 3
  • 12
  • 20