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(1714203914).isoformat()
print(readable)
# 2024-04-27T09:45:14+02: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-04-27 09:45:14

Using time.ctime

Another possibility to use function ctime from module time.


import time
readable = time.ctime(1714203914)
# Sat Apr 27 09:45:14 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(1714203914000);
console.log(ts.toDateString());
# Sat Apr 27 2024

Using Date.toISOString()

You can learn more about toISOString in documentation.


var ts = new Date(1714203914000);
console.log(ts.toISOString());
# %2024-04-27T09:45:14+02:00
This website uses cookies to ensure you get the best experience on our website. More info