Convert Timestamp to datetime in Python

To convert Timestamp to datetime object in Python, you can use the fromtimestamp() function from the datetime module of Python.

Example

import datetime

timestamp = 1615457713
date_obj = datetime.datetime.fromtimestamp(timestamp)
print(date_obj)
print(type(date_obj))
Output
2021-03-11 16:00:13
<class 'datetime.datetime'>