• Post Reply Bookmark Topic Watch Topic
  • New Topic

getting the timezone from the request

 
Renato Losio
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello.

is there any way to retrieve the user / browser timezone from the HTTP headers in the request?

cheers

renato
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you inspected the headers?
 
Renato Losio
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I tried, but I could not find anything useful (or may be I am not looking for the correct info):



Is there any way to have the info from the request.getLocale()? I didn't think so but may be I'm worng...

cheers

renato
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method request.getLocale() will give you a Locale object.

Using this object, you can call getter methods to get the language, country etc. But this will not give you a timezone (At least from my knowledge).

A workaround would be to use JavaScript.

In your JSP, have a hidden form variable which will be set to the the timezone from the client system.

A sample javascript code that would get you the timezone offset is shown below:


The hidden form value can be retrieved from your request object and you can do the necessary processing.
[ March 14, 2007: Message edited by: Sunil Vasudevan ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!