How to get browser time zone?

Ads
 

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?
Getting Information of All Available Time Zones
Advertisements
Example program to get all the 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'
JDBC: Get current Date and Time Example
ModuleNotFoundError: No module named 'sawyer-get-time'
ModuleNotFoundError: No module named 'zlc-get-time'
how to run a applet from browser
MySql Time Interval
Java get Elapsed Time
how to print the server time
how to print the server time
Java get GMT Time
HOW TO SHOW TIME SERIES
How to get Button Id ?
ModuleNotFoundError: No module named 'blockstack-zones'
How to compile & get output for JSP
how to get radio value
how to get following output
how to get following output
browser

Ads