There is no guarantee that the input will be properly parsed if in this format. The Date.parse () procedure is required only for parsing strings in a specific format - parsing of other formats is implementation dependent. If you dare to rely on implementations that satisfy the requirement, add the data to the specific format:
new Date(currentDate + '.000Z')
Alternatively, use a library that can analyze data in the current format, for example. jQuery or Globalize.js.
Similar considerations apply to the date of recording. There is no guarantee of the output format if you use Date.toString() , explicitly or as in alert(date) . Even on the same computer, different browsers will use different localized formats.
Jukka K. Korpela Jan 30 '12 at 11:44 2012-01-30 11:44
source share