Problem description
Today, I encountered a strange problem. on the server side, the current time obtained through Java is Fri Aug 28 09:37:46 CST 2009, which is converted to GMT at: 28 Aug 2009 01:37:46 GMT, that is to say, the GMT time plus 8 hours equals to the time indicated by CST. Isn't this CST Beijing time because we are in the GMT zone.
Everything looks normal, but there is a problem at the client's time for parsing with javascript:
// Fri Aug 28 2009 23:37:46 GMT + 0800 new date ('fri Aug 28 09:37:46 CST 2009 '). tostring ();
How strange is the difference between the time expressed in GMT and CST 14 hours?
Baidu
Find this article and the problem is clear.
GMT (Greenwich Mean Time) represents Greenwich Mean Time, which everyone knows.
However, CST can represent the following four different time zones:
- Central Standard Time (USA) UT-6: 00
- Central Standard Time (Australia) ut + 9: 30
- China Standard time ut + 8: 00
- Cuba Standard Time UT-4: 00
It can be seen that CST can also represent the standard time of the four countries in the United States, Australia, China, and Cuba.
The CST time obtained through Java previously uses the China Standard Time, while the client JavaScript uses the Central Time of the United States by default.
So the fri Aug 28 09:37:46 CST 2009 plus 6 hours, plus 8 hours, is equivalent to Fri Aug 28 2009 23:37:46 GMT + 0800
It can be seen that in future programming, in order to avoid errors, do not use CST time, but try to use GMT time.