Parsing ISO8601-like date in JavaScript: new Date() doesn't work across browsers
问题 How do I convert a date string coming from a database into a new Date() object? If I do the following: var x = new Date('2013-11-05 11:01:46:0'); alert(x); It works in Chrome, but in Safari it gives me the string "Invalid Date". Here's the fiddle. 回答1: The format of strings accepted by new Date(string) is implementation-dependent. If the browser correctly implements the ES5 specification, however, a strict subset of legal ISO 8601 strings should be accepted. Basically, you need to use UTC