wood burning stoves
The moose likes JSP and the fly likes want client's time zone from server side Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "want client Watch "want client New topic

want client's time zone from server side

prajyot jadhav

Joined: Dec 26, 2011
Posts: 6
"want client's time zone from server side":--
i am using an web application which runs on remote server, it shows the time and date in EST format as that of its server but i want to display that in its client's timezone
i tried to make so many changes in JSP and Java action classes but it always gives time in EST i.e. server side format....

can anyone please help me how can i get timezone of client which could be in any timezone..?
Tim Moores

Joined: Sep 21, 2011
Posts: 2409
You could use the client's IP adress to determine (approximately) her country and possibly city. That could be used to obtain the timezone. Alternatively, embed JavaScript code that contacts the server with the client-side time. The Java/JSP code running on the server will only ever give you the server time, so that's a dead end.
prajyot jadhav

Joined: Dec 26, 2011
Posts: 6
Thanks Tim..., could you please suggest how can i get client location from his IP in java or jsp
Paul Clapham

Joined: Oct 14, 2005
Posts: 19357

You could use some Javascript code which converts a date in the server's time zone to the corresponding date in the client's time zone. You'll notice that this forum displays times in your timezone; that's because it uses that Javascript code.
I agree. Here's the link: http://aspose.com/file-tools
subject: want client's time zone from server side