Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All experts

Is there any way to detect client timezone?.
I am facing the problem of timezone.I Need to convert UTC to other time zone.



Thanks in Advance
Sush
Posted
Comments
Shubhashish_Mandal 16-Apr-14 3:51am    
did you try javascript?
Sushant Mandhare 16-Apr-14 3:59am    
No but i need it in JSP Only
Shubhashish_Mandal 16-Apr-14 4:12am    
in jsp you can't. Because jsp run on server side and you need client side timezone .So to get it use the following javascript and pass it in any hidden filed to access it on server side
Sushant Mandhare 16-Apr-14 4:13am    
Ok thanks
Shubhashish_Mandal 16-Apr-14 4:35am    
Welcome !!!

1 solution

Try this

JavaScript
function getTimeZoneId(){
   var timezone=String(new Date());
   return timezone.substring(timezone.lastIndexOf('(')+1).replace(')','').trim();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900