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.

Ads









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
get absolute time java
ModuleNotFoundError: No module named 'zoner'
how i get experience wise resume from database when i submit from browser
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
Java Get Time in MilliSeconds
ModuleNotFoundError: No module named 'get-time'
ModuleNotFoundError: No module named 'get-time'
ModuleNotFoundError: No module named 'sawyer-get-time'
ModuleNotFoundError: No module named 'zlc-get-time'
JDBC: Get current Date and Time Example
Java get GMT Time
browser
ModuleNotFoundError: No module named 'blockstack-zones'
Java get Elapsed Time
how to run a applet from browser
Get current Date and Time
MySql Time Interval
how to print the server time
how to print the server time
How to disable browser back and forward button after logout [in struts2 or jsp]
How to compile & get output for JSP
How to get Button Id ?
Get Date and Time
HOW TO SHOW TIME SERIES

Ads