0

On the console in chrome browser of windows and Ubuntu I entered Date() object and I found both have a different way to write the timezone for that date.

Ubuntu: "Thu Aug 10 2017 18:45:18 GMT+0530 (IST)"

Windows: "Thu Aug 10 2017 18:45:18 GMT+0530 (India Standard Time)"

According to my use case the output on Ubuntu is correct, the time zone IST is what expected. But on windows it always shows up India Standard Time.

Is there a way to fix this for windows.

  • This is either a superUser question, or another *well thats called browser war :/* – Jonas Wilms Aug 10 '17 at 18:50
  • 1
    different browsers represent objects differently on their consoles. You are always free to format the date as you wish, like shown here https://stackoverflow.com/q/3552461/2557818 – Raja Anbazhagan Aug 10 '17 at 18:52

1 Answers1

1

According to my use case the output on Ubuntu is correct

Neither of them is correct. Or incorrect. The string form of a Date from toString (which is what those appear to be) is almost completely unspecified. The only requirement is that it represent the date, and that Date() and Date.parse should be able to parse it.

If you want something reliable cross browser*, use toISOString.


* Obsolete browsers may not have toISOString. Even only vaguely-modern browsers do.

T.J. Crowder
  • 879,024
  • 165
  • 1,615
  • 1,639