+ 2

How do I show different timezones in Javascript???

I am trying to make a code that shows different times from different timezones(India,UK,USA,Japan...etc).Can you pls show me a way how to do that? Thanks..

2nd Jan 2019, 11:26 AM
DCODER
4 Réponses
+ 4
As said on stack-overflow. It is not happening with pure JavaScript. But with use of library of JS, you can easily do it. https://stackoverflow.com/questions/18645788/javascript-display-various-time-zones
2nd Jan 2019, 12:35 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Hi DCODER, To get the timezone of the client, you can work with the getTimezoneOffset() method which returns the time difference between UTC time and local time If your clients time zone is GMT+1, -60 will be returned.
2nd Jan 2019, 12:38 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 2
Thanks guys..😁
2nd Jan 2019, 8:27 PM
DCODER
+ 1
Well, if you think of using js, get the client geolocation and make a 24-switch function for the 24 zones...a zone is a group of 15 longitudes
3rd Jan 2019, 2:58 AM
Ambele Newton
Ambele Newton - avatar