您好,欢迎来到步遥情感网。
搜索
您的当前位置:首页json日期数据转成日期字符串

json日期数据转成日期字符串

来源:步遥情感网


function ChangeDateFormat(jsondate) {

jsondate = jsondate.replace("/Date(", "").replace(")/", "");

if (jsondate.indexOf("+") > 0) {

jsondate = jsondate.substring(0, jsondate.indexOf("+"));

} else if (jsondate.indexOf("-") > 0) {

jsondate = jsondate.substring(0, jsondate.indexOf("-"));

}

//alert(jsondate);

var date = new Date(parseInt(jsondate, 10));

//alert(date.getHours());

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 ;

}

Copyright © 2019- obuygou.com 版权所有 赣ICP备2024042798号-5

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务