Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSF-Questions How to get browser time zone?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Dhanaraja
How to get browser time zone?
1 Answer(s)      2 years ago
Posted in : Java Server Faces Questions


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


Advertisement
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:
Advertisements
Advertisements
 

 

 

DMCA.com