fromtimestamp()
« Date
fromtimestamp() : returns date and time by using POSIX timestamp
Get all details about Timestamp and generate timestamp
by using Calendar and time sliders. »
Getting present timestamp
from datetime import datetime
timestamp = datetime.timestamp(datetime.now())
print("Present Timestamp : ",timestamp)
Output
Present Timestamp : 1568717876.556073
Using Timestamp as input we will use fromtimestamp() to get date and time
from datetime import datetime
timestamp = datetime.timestamp(datetime.now())
print("Present Timestamp : ",timestamp)
dt=datetime.fromtimestamp(timestamp)
print(dt)
Output
Present Timestamp : 1568717943.760438
2019-09-17 16:29:03.760438
You can use above mentioned timestamp genegrator and use this as input to generate date and time.
« All Date Objects
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com