In this article, you’ll learn how to convert timestamp string to DateTime object in python. We used the fromtimestamp()
from datetime
module. This method is used to convert the timestamp to readable DateTime format. This function returns the local date corresponding to the POSIX timestamp.
# Import Module
import datetime
Datetime= datetime.datetime.fromtimestamp(
int("1614948456")
).strftime('%Y-%m-%d %H:%M:%S')
# Print Output
print("Date Converted From Timestamp: ",Datetime)
Date Converted From Timestamp: 2021-03-05 18:17:36
I hope this article will help you to understand how to convert timestamp string to DateTime object in python.
Share your valuable feedback, please post your comment at the bottom of this article. Thank you!
Comments