How to Convert Milliseconds to Date in Javascript

0 min read 77 words

If you need to convert Milliseconds to Date in Javascript, then you can do the following:

How to Convert Milliseconds to Date in Javascript

let date = new Date(milliseconds);
date.toString();

Common Date Conversions From Milliseconds in Javascript

let originalDate = new Date(milliseconds);

// output: "D/MM/YYYY, H:MM:SS PM/AM"
originalDate.toLocaleString();

//output: "D/MM/YYYY"
originalDate.toLocaleDateString();

// output: "Day Month DD YYYY"
originalDate.toDateString();

// output: "HH:MM:SS GMT+0530"
originalDate.toTimeString();

// output: "Day Month DD YYYY HH:MM:SS GMT+0500"
originalDate.toString();

// output: "H:MM:SS AM/PM"
originalDate.toLocaleTimeString();
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags