Answers for "python convert from timestamp to time zone"

4

convert to timestamp python

import datetime
date = '18/05/2020 - 18:05:12'

# convert string to datetimeformat
date = datetime.datetime.strptime(date, "%d %m %Y - %H:%M:%S"")

# convert datetime to timestamp
date = datetime.datetime.timestamp(date)
Posted by: Guest on May-05-2020
2

Python 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 November-10-2020

Code answers related to "python convert from timestamp to time zone"

Python Answers by Framework

Browse Popular Code Answers by Language