Kiran Joshi wrote:There could be multiple timezones in a single country..
so that approach has limitations.
I feel, using javascript + Ajax + Servlet option is the most straightforward for this requirement.
Agreed! Also there could be clients who are using VPNs, public, coporate or private proxy servers. So, IP based mechanism will not identify timezones correctly. Application will store proxy server's timezone instead of client's.
Multiple timezones in a single country will be an issue, specially if the client's ISP is using NAT servers. In such case the IP of the NAT server will be checked, leading you to store the timezone of NAT server.
Anyway javascript + Ajax + Servlet will fail if client has JavaScript disabled. However I think it is better than just identifying timezone incorrectly. So you can ask the user to select the timezone, if JavaScript is disabled.
Or else use both methods. Use IP based mechanism if JavaScript is disabled.