Guest User

Untitled

a guest
Oct 3rd, 2021
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. #The strptime() method creates a datetime object from the given string.
  2.  
  3. #Using the strptime class to create datetime object
  4.  
  5. from datetime import datetime
  6.  
  7. date_string = '4 March 2002'
  8.  
  9. datetime_object = datetime.strptime(date_string,'%d %B %Y')
  10.  
  11. print(datetime_object)
Advertisement
Add Comment
Please, Sign In to add comment