User time zone
I have following problem. Portal server and end-user are situated in different time zones. In my portal component I need to show end-user time, i.e. local time for user. But if I call function
it returns a local time of server and not a local time of user.
As I know, I can get time zone information from user personalization:
But often, users don't define they time zone information. I suppose, there is ability to get such information from request object, because, as I know, http-browser transmits time zone information in http-request.
But all my attempts to get this information from request was not successful:
Both functions don't return time zone information.
Does anybody have any ideas about it?
Detlev Beutner replied
> I know, http-browser transmits time zone information
> in http-request
IE? If I call www.google.com, I cannot see the TZ anywhere, checked by HTTPWatch. There is also no corresponding setting within IE. You could only map prefered languages to locales, but that doesn't work really proper, for they work over different time zones.
Also see http://www.timeanddate.com/worldclock - no automatic detection.
Also see http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=Enterprisejava&Number=12640&page=1&view=collapsed&sb=9&o=&fpart=1
So I would suggest to use the user's time zone, and if not set, to use the server's time. It's the fault of the user admins if the time zone is not set!
> Both functions don't return time zone information
Right. And as said, mapping the locale to a time zone is a (bad) workaround, nothing I would advise.
Hope it helps