Timestamp To Date Converter
Convert timestamp to date or date to timestamp easily
Timestamp To Date
All languages has capability of converting timestamp to date. This page shows how to do it in several languages.
Python
Article with more details. Python expects timestamp as number of seconds since beginning of the Epoch.
Using datetime.isoformat
Module datetime provides classes for manipulating date and time in more object oriented way.
from datetime import datetime as dt
readable = dt.fromtimestamp(1732018579).isoformat()
print(readable)
# 2024-11-19T13:16:19+01:00
Using time.strftime
For custom human readable format you may use function strftime
.
import time
ts = time.gmtime()
print(time.strftime("%Y-%m-%d %H:%M:%S", ts))
# 2024-11-19 13:16:19
Using time.ctime
Another possibility to use function ctime
from module time
.
import time
readable = time.ctime(1732018579)
# Tue Nov 19 13:16:19 2024
JavaScript
Article with more details. JavaScript expects timestamp as number of miliseconds since beginning of the Epoch.
Using Date.toDateString()
You can learn more about toDateString
in documentation.
var ts = new Date(1732018579000);
console.log(ts.toDateString());
# Tue Nov 19 2024
Using Date.toISOString()
You can learn more about toISOString
in documentation.
var ts = new Date(1732018579000);
console.log(ts.toISOString());
# %2024-11-19T13:16:19+01:00