Bạn có thể dùng hàm fromtimestamp() từ module datetime để lấy date từ timestamp UNIX (số giây kể từ 1/1/1970). Hàm nhận timestamp làm đầu vào và trả về đối tượng datetime tương ứng.
Ví dụ
import datetime
timestamp = datetime.datetime.fromtimestamp(1500000000)
print(timestamp.strftime('%Y-%m-%d %H:%M:%S'))
Kết quả
2017-07-14 08:10:00
Lưu ý: Timestamp UNIX thường tính theo UTC. Hàm fromtimestamp() mặc định chuyển sang giờ địa phương (local timezone). Nếu cần UTC, dùng datetime.datetime.utcfromtimestamp().