Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

want client's time zone from server side

 
prajyot jadhav
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Bartender
Posts: 2847
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim..., could you please suggest how can i get client location from his IP in java or jsp
 
Paul Clapham
Sheriff
Posts: 21128
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic