Skip to content
Advertisement

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

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 timezone and later convert his date and time into some other timezone.

Does anybody has experience with this?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement