0
这个问题让我发疯。虽然我的代码在Firefox和Google chrome上运行良好,但它在Windows 10上的Internet Explorer上失败。但这个问题真的很奇怪。Internet Explorer中的日期问题无效
// If I hard code this value, it works fine,
// But the same thing generated by the program fails!
//var dateStr = '2016-08-04 01:38:49'
alert(dateStr)
var a = dateStr.split(" ");
d = a[0].split("-");
t = a[1].split(":");
return new Date(d[0],(d[1]-1),d[2],t[0],t[1],t[2]);
变量dateStr
是由我的程序填补,并与它返回的日期总是出来是无效的。但是,如果我从警报框中复制dateStr
的值,并稍后用它对值dateStr
进行硬编码,则返回有效日期。到底是怎么回事?我在这里错过了什么吗?我怀疑,这必须做一些与Unicode字符串和东西。它可能是什么?