Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to convert string date to timestamp in Python

import time
import datetime

# date in string format
dt="23/04/2022"

# convert into the time tuple
time_tuple=datetime.datetime.strptime(dt, "%d/%m/%Y").timetuple()
print("Time tuple format ",time_tuple)

# using mktime() convert to timestamp
print("The timestamp is ",time.mktime(time_tuple))
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #How #convert #string #date #timestamp #Python
ADD COMMENT
Topic
Name
1+6 =