1
2from datetime import datetime
3
4timestamp = 1545730073
5dt_object = datetime.fromtimestamp(timestamp)
6
7print("dt_object =", dt_object)
8print("type(dt_object) =", type(dt_object))
9
1
2from datetime import datetime
3
4# current date and time
5now = datetime.now()
6
7timestamp = datetime.timestamp(now)
8print("timestamp =", timestamp)
9