IOS真机上new Date()时间格式问题,Bug?
发布于 5 年前 作者 vkang 19748 次浏览 来自 问答
console.log('new Date("2016-12-29") =', new Date("2016-12-29"));
    console.log('new Date("2016.12.29") =', new Date("2016.12.29"));
    console.log('new Date("2016-12-29 18:00") =', new Date("2016-12-29 18:00"));
    console.log('new Date("2016-12-29 18:00:00") =', new Date("2016-12-29 18:00:00"));

打印结果:

取时间格式的几种写法,发现不能设时分秒,有什么办法可以破?

3 回复

万能的__时间戳__

在 iOS 上,小程序的 javascript 代码是运行在 JavaScriptCore 中

所以,你需要把-改成/

回到顶部