<h3 style="Box-sizing: border-Box; font-weight: 500; line-height: 1.1; color: rgb(51,51,51); margin-top: 1.6em; margin-bottom: 0.6em; font-size: 20px; white-space: normal;">
<span style="Box-sizing: border-Box; font-weight: 700;">小<span style="Box-sizing: border-Box; font-weight: 700;">程序时间转换年月日,小程序时间转换,小程序时间格式化
Box-sizing: border-Box; font-weight: 700;">
/** * 时间戳转化为年 月 日 时 分 秒 * time : 传入时间 2018-07-26 17:58:54 * format:返回格式,支持自定义,但参数必须与formateArr里保持一致 */ function formatToTime(time, format) {var formateArr = ['Y', 'M', 'D', 'h', 'm', 's'];
var returnArr = [];//var
var time = time.replace(/-/g, '/');
var date = Date.parse(time);
date = new Date(date);
returnArr.push(date.getFullYear());
returnArr.push(formatNumber(date.getMonth() + 1));
returnArr.push(formatNumber(date.getDate()));returnArr.push(formatNumber(date.getHours()));
returnArr.push(formatNumber(date.getMinutes()));
returnArr.push(formatNumber(date.getSeconds()));for (var i in returnArr) {
format = format.replace(formateArr[i], returnArr[i]);
}
return format;
}
Box-sizing: border-Box; font-weight: 700;">