Answers for "convert datetime.datetime to timestamp in python 2.7"

1

python convert timestamp to datetime

from datetime import datetime

timestamp = 1545730073
dt_object = datetime.fromtimestamp(timestamp)

print("dt_object =", dt_object)
print("type(dt_object) =", type(dt_object))
Posted by: Guest on January-15-2021
1

python convert date to timestamp

import time
import datetime
s = "01/12/2011"
time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple())
Posted by: Guest on February-04-2021

Code answers related to "convert datetime.datetime to timestamp in python 2.7"

Python Answers by Framework

Browse Popular Code Answers by Language