Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Changing date format of DateTime widget
Changing date format of DateTime widget [message #115039] Tue, 09 December 2008 14:32 Go to next message
Setya Mising name is currently offline Setya Mising nameFriend
Messages: 491
Registered: July 2009
Senior Member
Hi,

Is it possible to change the date format in DateTime Widget ? When I first
try it, the format is MM/dd/yyyy, I want to change it into dd/MM/yyyy.

Regards,

Setya
Re: Changing date format of DateTime widget [message #115076 is a reply to message #115039] Tue, 09 December 2008 15:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ifurnadjiev.innoopract.com

Hi Setya,

the format of date in DateTime widget depends on client (browser) locale
(language). If the browser content language is en-US the format will be
MM/dd/yyyy, but if it is German (de-de) for example, the format will be
dd/MM/yyyy. To check this you can set in Firefox your preferred language
in Options -> Content -> Languages and see the result. Anyway, there is
no explicitly way to set to format if DateTime widget. This is the same
in SWT.

Best,
Ivan

Setya wrote:
> Hi,
>
> Is it possible to change the date format in DateTime Widget ? When I
> first try it, the format is MM/dd/yyyy, I want to change it into
> dd/MM/yyyy.
>
> Regards,
>
> Setya
>
Re: Changing date format of DateTime widget [message #115100 is a reply to message #115039] Tue, 09 December 2008 15:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Use RWT#getLocale() to query the currently used locale and
RWT#setLocale() to alter it.
The date time widget uses this information to display date and time
information.

HTH
RĂ¼diger

Setya wrote:
> Hi,
>
> Is it possible to change the date format in DateTime Widget ? When I
> first try it, the format is MM/dd/yyyy, I want to change it into
> dd/MM/yyyy.
>
> Regards,
>
> Setya
>
Re: Changing date format of DateTime widget [message #940894 is a reply to message #115076] Fri, 12 October 2012 03:29 Go to previous message
tran van ha is currently offline tran van haFriend
Messages: 2
Registered: October 2012
Junior Member
Please try with code:

public class LocaleConfig {
public static final String LOCALE_COUNTRY_DEFAULT = "VN";


public static void setDefaultLocale() {
Locale locale = RWT.getLocale();
if (LOCALE_COUNTRY_DEFAULT.equals(locale.getCountry())) {
return;
}
Locale defaultLocale = null;
Locale[] locales = Locale.getAvailableLocales();

for (Locale loc : locales) {
if (LOCALE_COUNTRY_DEFAULT.equals(loc.getCountry())) {
defaultLocale = loc;
break;
}
}
if (defaultLocale != null) {
RWT.setLocale(defaultLocale);
}
}

}
Previous Topic:RAP 1.5 GUI testing
Next Topic:Mouse Wheel Scrolling very slow
Goto Forum:
  


Current Time: Mon Dec 22 05:14:50 GMT 2014

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

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