DateTime 格式 "/Date(1554357128000)/" 数据 在Javascript转string时间

//先截取获得时间戳

var time = parseInt(DateTime.toString().substring(6, value.toString().length - 2));
var oDate = new Date(time);
console.log(time);
console.log(oDate.toString());
return utcToDate(oDate.toString());

function utcToDate(utcCurrTime) {
    utcCurrTime = utcCurrTime + "";
    var date = "";
    var month = new Array();
    month["Jan"] = 1;
    month["Feb"] = 2;
    month["Mar"] = 3;
    month["Apr"] = 4;
    month["May"] = 5;
    month["Jun"] = 6;
    month["Jul"] = 7;
    month["Aug"] = 8;
    month["Sep"] = 9;
    month["Oct"] = 10;
    month["Nov"] = 11;
    month["Dec"] = 12;
    var week = new Array();
    week["Mon"] = "一";
    week["Tue"] = "二";
    week["Wed"] = "三";
    week["Thu"] = "四";
    week["Fri"] = "五";
    week["Sat"] = "六";
    week["Sun"] = "日";

    str = utcCurrTime.split(" ");
    date = str[3] + "-" + getzf(month[str[1]]) + "-" + str[2];
    return date;
}

function getzf(num) {
 if (parseInt(num) < 10) {
    num = '0' + num;
}
	return num;
}

你可能感兴趣的:(DateTime 格式 "/Date(1554357128000)/" 数据 在Javascript转string时间)