Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect the timezone of a client?

How to get client/request timezone in jsp?

like image 957
user353682 Avatar asked Jun 08 '10 20:06

user353682


People also ask

What is client time zone?

When Client Time Zone is enabled, the client passes its time zone information (not the clock time) to the server. The server obtains the client's time zone information (GMT, daylight saving, and so on) and compares it with its own time zone information.

How do I get current timezone in typescript?

To get the current browser's time zone, you can use the getTimezoneOffset() method from the JavaScript Date object. The getTimezoneOffset() returns the time difference, in minutes, between UTC time and local time.

How does JavaScript determine timezone?

The JavaScript getTimezoneOffset() method is used to find the timezone offset. It returns the timezone difference in minutes, between the UTC and the current local time. If the returned value is positive, local timezone is behind the UTC and if it is negative, the local timezone if ahead of UTC.

How do you find the current time zone using a moment?

var tz = moment. tz. guess(); It will return an IANA time zone identifier, such as America/Los_Angeles for the US Pacific time zone.


1 Answers

Unfortunately this information is not passed in HTTP headers.

Usually you need cooperating JavaScript to fetch it for you.
Web is full of examples, here is one http://www.coderanch.com/t/486127/JSP/java/Query-timezone

like image 122
Alexander Pogrebnyak Avatar answered Oct 01 '22 18:10

Alexander Pogrebnyak