'How to convert a number to a date in JavaScript [duplicate]

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?



Solution 1:[1]

You can use this:

var date = new Date(1546108200 * 1000);
console.log(date.toUTCString())

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 KyleMit