The problem is with IST
that doesn't converted by DateTimeFormat
Try this one, Its working fine without IST
in pattern
DateTimeFormat fmt = DateTimeFormat.getFormat("EEE MMM dd HH:mm:ss yyyy");
Date checkInDate = fmt.parse("Fri Feb 21 00:00:00 2014");
System.out.println(DateTimeFormat.getFormat("dd/MMM/yyyy").format(checkInDate));
or use GMT
in place of IST
as shown below
DateTimeFormat fmt = DateTimeFormat.getFormat("EEE MMM dd HH:mm:ss v yyyy");
Date checkInDate = fmt.parse("Fri Feb 21 00:00:00 GMT+05:30 2014");
System.out.println(DateTimeFormat.getFormat("dd/MMM/yyyy").format(checkInDate));
Simply call a GWT RPC call and at server try below code to find out your localized date format and use it now.
Locale locale = httpServletRequest.getLocale();
final Date currentDate = new Date();
final DateFormat dateInstance = DateFormat.getDateInstance(DateFormat.FULL, locale);
final String format = dateInstance.format(currentDate);
System.out.println(format);
if (dateInstance instanceof SimpleDateFormat) {
System.out.println("pattern: " + ((SimpleDateFormat) dateInstance).toPattern());
System.out.println("localized pattern: "+((SimpleDateFormat) dateInstance).toLocalizedPattern());
}
Here is the sample code about date pattern at internationalization sample
Here is one more link to read about How to get the pattern of Number Format of a specific locale? at server side.