How to convert a number to a date in JavaScript
35,498
You can use this:
var date = new Date(1546108200 * 1000);
console.log(date.toUTCString())
Related videos on Youtube
Author by
K Vinodh Kumar
Updated on March 31, 2022Comments
-
K Vinodh Kumar over 1 year
I have a number, "1546108200", in epoch format.
I want to convert into a date format, like "Sunday, December 30, 2018 12:00:00 AM".
How can I do that?
-
ic3b3rg almost 5 years
new Date(1546108200 * 1000)
-
Code Maniac almost 5 yearsWhere you're facing problem ?
-
Peter Mortensen over 1 year"epoch format" = Unix time?
-
-
Nick over 1 yearwhy do you need to multiply with 1000?