format string from Date.getTime()

javascript

Solution

You need to pass the UNIX time as a parameter to a new date object and can then use `.toString()` to get a readable interpretation. Like this:

new Date(1395430135200).toString()
// "Fri Mar 21 2014 20:28:55 GMT+0100 (W. Europe Standard Time)"

Problem

For some reason I can't find the answer to how to format a string from new Date().getTime(). When I run this string, I get a sequence of numbers such as 1395430135200. How do I format this back into a readable date with time zone?

Original source