on 04-07-2006 2:12 PM
Dear Experts,
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
Calendar.getInstance().getTime()
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:
((IUser) request.getUser()).getTimeZone()
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:
request.getLocale()
request.getUser().getLocale()
Both functions don't return time zone information.
Does anybody have any ideas about it?
Hi Egor,
> 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.
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
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.