Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python convert string datetime into datetime

# import the datetime module
import datetime
  
# datetime in string format for may 25 1999
input = '2021/05/25'
  
# format
format = '%Y/%m/%d'
  
# convert from string format to datetime format
datetime = datetime.datetime.strptime(input, format)
  
# get the date from the datetime using date() 
# function
print(datetime.date())
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #convert #string #datetime #datetime
ADD COMMENT
Topic
Name
6+6 =