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(1669789809).isoformat()
print(readable)
# 2022-11-30T07:30:09+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))
# 2022-11-30 07:30:09

Using time.ctime

Another possibility to use function ctime from module time.


import time
readable = time.ctime(1669789809)
# Wed Nov 30 07:30:09 2022

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(1669789809000);
console.log(ts.toDateString());
# Wed Nov 30 2022

Using Date.toISOString()

You can learn more about toISOString in documentation.


var ts = new Date(1669789809000);
console.log(ts.toISOString());
# %2022-11-30T07:30:09+01:00
This website uses cookies to ensure you get the best experience on our website. More info