Thursday 12 October 2017

How to retrieve Client's Timezone in GWT

  • Let say Application is hosted at one place whose time zone is 'A'
  • User can login any where from the world whose time zone is 'B'
  • So the server where the application is hosted should know the time zone of the user access
To retrieve the client browser time zone ,use GWT DateTimeFormat

 DateTimeFormat.getFormat("ZZZZ").format(new Date())

The above method will give the browser time zone.

There is one more way to retrieve the time zone is to use JSNI

private native int getClientOffsetTimeZone() /*-{
    return new Date().getTimezoneOffset();
}-*/;

Note that the getTimezoneOffset() method returns the time difference between UTC time and local time in minutes,
For example,
 If your time zone is GMT+2, -120 will be returned
 If your time zone is GMT-2, +120 will be returned

CSS Selectors

  CSS Selectors In CSS, selectors are patterns used to select the element(s) you want to style There are 3 different types of CSS selectors ...