How to get browser time zone?

How to get browser time zone?

How to get browser Time Zone and browser date using java concept

View Answers

June 17, 2013 at 6:08 PM

hi friend,

There is no HTTP standard that allow the browser to tell the server about the time. So, to get the time zone you may use the following code snippet.

<html>
<head>
<title> Home </title>
<script type="text/javascript">

var userDate = new Date();  
var userTimeZone = ( userDate.getTimezoneOffset()/60 )*( -1 );  

alert("Timezone = " + userTimeZone );
alert("Date : "+userDate); 
</script>
</head>
<body>
<h2>Get TimeZone Example</h2>
</body>
</html>

Thanks.









Related Tutorials/Questions & Answers:
How to get browser time zone?
Example program to get all the available time zones
Advertisements
Getting Information of All Available Time Zones
how to get browser cookies in java
how to get time picker value in javascript of struts2
ModuleNotFoundError: No module named 'zoner'
get absolute time java
How can we get second of the current time using date function?
how i get experience wise resume from database when i submit from browser
PHP Get Browser IP Address
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
get integer at run time
detecting browser time zone - Java Interview Questions
Java Get Time in MilliSeconds
PHP Get Browser Information
ModuleNotFoundError: No module named 'get-time'
ModuleNotFoundError: No module named 'get-time'
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet
ModuleNotFoundError: No module named 'zlc-get-time'
ModuleNotFoundError: No module named 'sawyer-get-time'
JDBC: Get current Date and Time Example
ModuleNotFoundError: No module named 'blockstack-zones'
Java get GMT Time
Java get Elapsed Time
how to disable browser back button
Get current Date and Time
browser
MySql Time Interval
how to display pdf file on browser
how to run a applet from browser
how to dispaly pdf file on browser
how to print the server time
Get Date and Time
how to print the server time
How to get Button Id ?
How to compile & get output for JSP
HOW TO SHOW TIME SERIES
j2me- how to subtract time s in j2me???
how to get radio value
how to get following output
how to get following output
How to get the current date in Java?
How to print current time in r?
Outsourcing Time Factors, How to Examine Outsourcing Time
How to disable browser back and forward button after logout [in struts2 or jsp]
How to get project path
How to get project path
How to get Java SDK
how to get UIView by tag

Ads