我的代码是这样的:
createDate = '2016-07-12 09:09:38';
createDate = new Date(createDate);
console.log(createDate);
结果 : Date {Invalid Date}
我想要这样的结果: Date {Tue Jul 12 2016 09:53:13 GMT+0700 (SE Asia Standard Time)}
有什么解决方案可以解决我的问题吗?
使用此ISO-8601格式:
createDate = '2016-07-12T09:09:38'; //watch for the T in between
createDate = new Date(createDate);
console.log(createDate);
这里的UTC时区用于解释参数。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句