第一种在后台将日期变成 string类型
tostring()方法
第二种是下列:
function timeStamp2String (time){
var datetime = new Date();datetime.setTime(time);
var year = datetime.getFullYear();
var month = datetime.getMonth() + 1;
var date = datetime.getDate();
var hour = datetime.getHours();
if(hour<=9){
hour="0"+hour;
}
var minute = datetime.getMinutes();
if(minute<=9){
minute="0"+minute;
}
var second = datetime.getSeconds();
if(second<=9){
second="0"+second;
}
// var mseconds = datetime.getMilliseconds();
return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second;//+"."+mseconds;
};