I am having problem using Date Object, when I try to parse unix-timestamp.
example:
//I am receiving json data that contains Unix-Timestamp like 1348514100000
var unixTimestamp = data.timestamp; //1348514100000
var date = new Date(unixTimestamp);
console.log(date.getDay()); // is wrong..
and example 2:
var unixTimestamp = data.timestamp; //1348514100000
var date = new Date();
date = date.setDate(unixTimestamp);
console.log(date.getDay()); // still wrong..
I have tried to parse string-timestamp to convert int with
var intUT = parseInt(unixTimestamp);
but still not the correct date&time.. I have really no idea what to do. How can I get the correct date and time from this unix timestamp?
Thank you!
Date()object in JavaScript.Date()constructor, I get "Mon Sep 24 2012 14:15:00 GMT-0500 (CDT)", which looks right to me.new Date(+unixTimestamp)in other words ...