开发者

javascript - convert localtime to different timezone

开发者 https://www.devze.com 2023-01-22 12:56 出处:网络
Does anyone know how to 开发者_运维知识库convert \"Date().getTime()\" to UTC? Obviously the getTime() is the users local time so I need a function to get the users timezone, convert the timestamp to

Does anyone know how to 开发者_运维知识库convert "Date().getTime()" to UTC?

Obviously the getTime() is the users local time so I need a function to get the users timezone, convert the timestamp to UTC so I can then * it by -8 to get the current PST time.


Date.getTimezoneOffset()

as seen here. It returns the user's browser time relative to GMT, which you'll compare to your server time, relative to GMT.

0

精彩评论

暂无评论...
验证码 换一张
取 消