js反序列化时间
2020-12-13 16:07
标签:blog http get width os cti js反序列化时间,搜素材,soscw.com js反序列化时间 标签:blog http get width os cti 原文地址:http://www.cnblogs.com/taomylife/p/3797266.html var time = "/Date(1279270720000+0800)/";
var tme1 = ChangeDateFormat(time); alert(tme1);
JS方法为:
function ChangeDateFormat(cellval) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
var month = date.getMonth() + 1 "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() "0" + date.getDate() : date.getDate();
return date.getFullYear() + "-" + month + "-" + currentDate;
}