Get timezone from users browser using moment(timezone).js

前端 未结 5 624
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 19:40

What is the best way to get client\'s timezone and convert it to some other timezone when using moment.js and moment-timezone.js

I want to find out what is clients t

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 20:15

    var timedifference = new Date().getTimezoneOffset();
    

    This returns the difference from the clients timezone from UTC time. You can then play around with it as you like.

提交回复
热议问题