js日期处理(毫秒数转化日期类型)

var a=new Date();
var now = new Date(a.getTime());
s = d.getFullYear() + "-";
s+=("0"+(d.getMonth()+1)).slice(-2) + "-";
s+= ("0"+d.getDate()).slice(-2) + " ";
s+= ("0"+d.getHours()).slice(-2) + ":";   
s+= ("0"+d.getMinutes()).slice(-2) + ":"       
s+=("0"+d.getSeconds()).slice(-2);
s+= ("00"+d.getMilliseconds()).slice(-3);
alert(s);

你可能感兴趣的:(java)