xxxxxxxxxx
>>> datetime.datetime.fromtimestamp(1284286794)
datetime.datetime(2010, 9, 12, 11, 19, 54)
xxxxxxxxxx
>>> import datetime
>>> datetime.datetime.fromtimestamp(1347517370).strftime('%Y-%m-%d %H:%M:%S')
'2012-09-13 14:22:50' # Local time
xxxxxxxxxx
>>> import datetime
>>> datetime.datetime.utcfromtimestamp(1347517370).strftime('%Y-%m-%d %H:%M:%S')
'2012-09-13 06:22:50'
# utc time
xxxxxxxxxx
import datetime
epoch_time = 1609459200 # Assuming the epoch time is provided
converted_time = datetime.datetime.fromtimestamp(epoch_time)
# If you need the datetime in a specific format, use strftime()
formatted_time = converted_time.strftime("%Y-%m-%d %H:%M:%S")
print(formatted_time)