javascript change timestamp value '1434460015' to 'y-m-d' -
i know how change date readable format in php below
$jobpostdate = date("y-m-d", '1434460015');
how can same thing javascript if have unix timestamp value 1434460015
or other unix timestamp value value , have within ajax success function, can syntax?
simple use
new date(1434460015000) //if it's in second convert millisecond *1000
for format need in manual way
var today=new date(1434460015000); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear(); if(dd<10){ dd='0'+dd } if(mm<10){ mm='0'+mm } var today = dd+'/'+mm+'/'+yyyy; alert(today);
Comments
Post a Comment