Table of Contents
Introduction
A timestamp value is number of seconds between the current date and date Jan 1,1970 at UTC. The task is to convert the timestamp value to the date object.
Program
from datetime import datetime output = datetime.fromtimestamp(1546853289) print("Date and time is:: ", output)
Output
Explanation
In the above program, we have used python in-built function fromtimestamp() of datetime module. The fromtimestamp() function takes two argument timestamp value and tz (optional argument).
0 Comments