Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

datetime to unix timestamp python

# importing datetime module
import datetime
import time
 
# assigned regular string date
date_time = datetime.datetime(2021, 7, 26, 21, 20)
 
# print regular python date&time
print("date_time =>",date_time)
 
# displaying unix timestamp after conversion
print("unix_timestamp => ",
      (time.mktime(date_time.timetuple())))
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #datetime #unix #timestamp #python
ADD COMMENT
Topic
Name
2+7 =