Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Client Time Zone(Get the client time zone)
Client Time Zone [message #635584] Wed, 27 October 2010 12:38 Go to next message
Tiber Sept is currently offline Tiber SeptFriend
Messages: 32
Registered: February 2010
Member
Hi Forum,

I could get the client locale via:

RWT.getLocale()


but I could find no such method for time zone.

Have I missed something ? If I haven't, is there an easy way to retrieve the Time Zone of the browser ? I mean something like using:

new Date().getTimezoneOffset()


Thanks & regards,
tibersept





Re: Client Time Zone [message #635824 is a reply to message #635584] Thu, 28 October 2010 09:20 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

there is no such method yet in RWT, but it sounds generally possible. If
you have a use case for it, please open an enhancement request in our
bugzilla.

Regards, Ralf

--
Ralf Sternberg

Need professional support for RAP and RCP?
http://www.eclipsesource.com/support/

Twitter: http://twitter.com/eclipsesource
Blog: http://www.eclipsesource.com/blogs/
Re: Client Time Zone [message #636057 is a reply to message #635584] Fri, 29 October 2010 08:19 Go to previous messageGo to next message
Tiber Sept is currently offline Tiber SeptFriend
Messages: 32
Registered: February 2010
Member
Hello Ralf,

I filed the Enhancement Request. I am not sure whether my use case really requires this feature.

The scenario is this. I need to work with the UTC timezone on the server, i.e. ( Calendar and DateFormat UTC, obviously Date is always UTC ) but the client should enter the date in his local time (mostly, in some explicit cases the timezone is predefined).

From what I could test, the DateTime widget delivers the time entered by the user in his/her local time zone, and I need to know that user time zone to make the conversion. Please correct me if I have missed something here.

I got a solution for now, I added two phase listeners, the first one uploads the following code:

var rightNow = new Date(); 
var jan = new Date( rightNow.getFullYear(), 0, 1, 2, 0, 0 );
var jul = new Date( rightNow.getFullYear(), 6, 1, 2, 0, 0);					
var ofs = Math.max( jan.getTimezoneOffset(), jul.getTimezoneOffset() ) * 60000 * (-1);
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( someConstant, ofs );
req.send();


and the second one waits for the result & converts it to java.uti.TimeZone - guessing the timezone from TimeZone.getAvailableIDs( rawOffset ) . Both remove themselves once they are run. I could not find anything better, would you have any ideas ?

Thanks & regards,
tibersept

[Updated on: Fri, 29 October 2010 11:24]

Report message to a moderator

Re: Client Time Zone [message #636103 is a reply to message #636057] Fri, 29 October 2010 10:10 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

sounds reasonable, thanks for the bug report. Could you also add your
explanation and example code to the bug report? This may help to get
started.

Thanks and regards, Ralf

--
Ralf Sternberg

Need professional support for RAP and RCP?
http://www.eclipsesource.com/support/

Twitter: http://twitter.com/eclipsesource
Blog: http://www.eclipsesource.com/blogs/
Re: Client Time Zone [message #636114 is a reply to message #636103] Fri, 29 October 2010 11:25 Go to previous message
Tiber Sept is currently offline Tiber SeptFriend
Messages: 32
Registered: February 2010
Member
Ok, done. Thanks for the help & answers.
Previous Topic:FORM based authentication + static content
Next Topic:Integrating JBOSS Visual Page Editor in RAP application
Goto Forum:
  


Current Time: Fri Apr 26 00:00:19 GMT 2024

Powered by FUDForum. Page generated in 0.05731 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top