//时间转换成时间戳
function DateToUnix(string) { var f = string.split(' ', 2); var d = (f[0] ? f[0] : '').split('-', 3); var t = (f[1] ? f[1] : '').split(':', 3); var time = (new Date( parseInt(d[0], 10) || null, (parseInt(d[1], 10) || 1) - 1, parseInt(d[2], 10) || null, parseInt(t[0], 10) || null, parseInt(t[1], 10) || null, parseInt(t[2], 10) || null )).getTime() / 1000 return time; } //GMT时间格式转换成字符串 function GMTToStr(time) { let date = new Date(time) let Str = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() return Str }//时间转换成GMT格式
function parserDate(date) { var t = Date.parse(date);if(!isNaN(t)) {
return new Date(Date.parse(date.replace(/-/g, "/"))); } else { return new Date(); } };