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
ModuleNotFoundError: No module named 'zoner'
how to get time picker value in javascript of struts2
detecting browser time zone - Java Interview Questions
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
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet
get absolute time java
How can we get second of the current time using date function?
PHP Get Browser Information
Java Get Time in MilliSeconds
PHP Get Browser IP Address
how i get experience wise resume from database when i submit from browser
get integer at run time
ModuleNotFoundError: No module named 'blockstack-zones'
ModuleNotFoundError: No module named 'get-time'
ModuleNotFoundError: No module named 'get-time'
Java get GMT Time
browser
Java get Elapsed Time
how to disable browser back button
ModuleNotFoundError: No module named 'sawyer-get-time'
ModuleNotFoundError: No module named 'zlc-get-time'
how to display pdf file on browser
Get Date and Time
how to dispaly pdf file on browser
JDBC: Get current Date and Time Example
how to run a applet from browser
Get current Date and Time
how to print the server time
Get Time Stamp
how to print the server time
How to disable browser back and forward button after logout [in struts2 or jsp]
j2me- how to subtract time s in j2me???
HOW TO SHOW TIME SERIES
Get Time Zone
browser
Outsourcing Time Factors, How to Examine Outsourcing Time
how to display multiple images on browser
how to display multiple images on browser
How to display the current time
browser
How to print current time in r?
how to present the excel to the web browser in jsp
How to convert date to time in PHP?
How much time - Java Beginners
how to display the excel file in the web browser.

Ads