Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #The strptime() method creates a datetime object from the given string.
- #Using the strptime class to create datetime object
- from datetime import datetime
- date_string = '4 March 2002'
- datetime_object = datetime.strptime(date_string,'%d %B %Y')
- print(datetime_object)
Advertisement
Add Comment
Please, Sign In to add comment