search

Home  >  Q&A  >  body text

javascript - Date.parse, different date formats, different output problems

I guess 2017/04/04 is parsed according to the local time zone, and 2017-04-14 is parsed according to Greenwich Time because the time zone is not specified? ? ? ? ?

If the input date does not specify a time zone, the parsing will be different. When 8 is added after 2017-04-14, the parsing result is the same as that of 2017/04/14.

Why does adding 00:00:00 at the end result in the same analysis?

世界只因有你世界只因有你2778 days ago571

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:43:58

    This is a breaking change in the ES 6 specification. As early as 2015, someone had submitted a related issue to Chrome: https://bugs.chromium.org/p/c...

    For more detailed information, please refer to my previous answer on Zhihu About JavaScript's new Date, a strange date behaves differently in Firefox and Chrome?

    reply
    0
  • Cancelreply