getDay() returns the day of the week. To get the date, use date.getDate() . getMonth() returns a month, but the month is zero, so using getMonth()+1 should give you the correct month. The time value seems to be good here, although the hour is 23 (GMT + 1). If you want universal values, add UTC to the methods (e.g. date.getUTCFullYear() , date.getUTCHours() )
var timestamp = 1301090400, date = new Date(timestamp * 1000), datevalues = [ date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), ]; alert(datevalues);
KooiInc Mar 24 '11 at 9:17 2011-03-24 09:17
source share