同求 Java 返回的格林时间, 在ios上用普通的方法没法转换成时间戳 , 求解 @官方
var newDate = GMTToStr(2018-08-21T01:52:36.000+0000, 'Y/M/D h:m:s').replace(/-/g, '/')
function GMTToStr(time){
console.log(time)
let date = new Date(time)
let Str = date.getFullYear() + '-' +
(date.getMonth() + 1) + '-' +
date.getDate() + ' ' +
date.getHours() + ':' +
date.getMinutes() + ':' +
date.getSeconds()
console.log(Str)
return Str
}
ios返回null
Note: parsing of date strings with the Date
constructor (and Date.parse
, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date