function time(time) {
return time.substr(0, 19).replace('T', ' ');
}
//修改日期的格式
function ChangeDateFormat(cellval) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
//getMonth()從0開始算
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return date.getFullYear() + "-" + month + "-" + currentDate;
}
//去掉時分秒
function DropSFM(time_str) {
var temp = new Date(time_str);
return temp.getFullYear() + "-" + (temp.getMonth() + 1) + "-" + temp.getDate();
}
js修改日期格式
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.