Converting JSON string into date

javascript, jquery, json

Solution

That would be seconds, and javascript uses milliseconds which would be

1351993013​000

which would give you Sunday Nov 04 2012.

in other words:

var jsonDate = parseInt(plugin.versions[0].date, 10) * 1000;

Problem

Possible Duplicate: Convert a Unix timestamp to time in Javascript I'm trying to convert the string that this api returns for date. The format is `1351993013`. I tried the following line of JS but the date is completely wrong. ``` var jsonDate = plugin.versions[0].date; var pluginDate = new Date(jsonDate); ``` Which returns: ``` Fri Jan 16 1970 ``` This is the first time I've tried to format a JSON date so it's a bit confusing. Can anyone help?

Original source

Related problems