31
rated 0 times
[
32]
[
1]
/ answers: 1 / hits: 68185
/ 13 Years ago, tue, february 28, 2012, 12:00:00
I have a unix timestamp, e.g., 1313564400000.00. How do I convert it into Date object and get month/year/day accordingly? The following won't work:
function getdhm(timestamp) {
var date = Date.parse(timestamp);
var month = date.getMonth();
var day = date.getDay();
var year = date.getYear();
var formattedTime = month + '/' + day + '/' + year;
return formattedTime;
}
More From » timestamp