i am working on an website that will be accessed by users along different timezones. As a requirement of the website, i need to get the client's date and time at the server side. Similarly, i need to convert server's date into client's date before sending any date related information to the client.
I have seen getLocale() method of HttpServletRequest but it doesn't provide any information about client's date and time....
You can use java script and a hidden variable to store and retrurn the date. But in case the customisation is required on the first page that is accessed them it might be difficult with using servlets only.
You could include a small applet on the page which reads the time from the browser and sends it direct to the server.
What most time-sensitive applications do, though is to use a cookie containing a time offset from server time. Typically the web application might try to read the cookie on each communication from a client browser - if the cookie is absent, redirect to a "whast time is it?" page, then set the cookie based on the answer before forwarding to the real destination page. Much like login, really.
So I think you can safely rely on it.
Have a initial home page which will be accessed and sent to the browser. On that page write java script code on onload function.
window.location.href = "http://yourlocation/myactualhome?date="+ new Date();
This will redirect to you actual home page and you can get the date and time as parameter.