by @kodeazy
How to convert timestamp to date in javscript?
In this blog we will discuss on how to convert timestamp
to date
in javascript.
lets suppose I have a timestamp as below.
var timestamp=(new Date()).getTime();
console.log(timestamp);
output
1672812872560
To convert above timestamp
into date we pass timestamp
as an argument to new Date()
function.
Below is an example.
console.log(new Date(timestamp));
Output
Wed Jan 04 2023 11:44:32 GMT+0530 (India Standard Time)