I am getting a date from JSON in the following format 22 07 2014 12:04:12
.
This is the code I have written:
field.setCellFormatter(new CellFormatter() {
@Override
public String format(Object arg0, ListGridRecord arg1, int arg2, int arg3) {
final DateTimeFormat fmt = DateTimeFormat.getFormat("dd MM yyyy hh:mm");
final Date date = (Date) arg0;
arg1.setAttribute(name, date);
return fmt.format(date);
});
where field
is the Date field in ListGrid.
But this displays a blank field in the ListGrid. I can't figure out a way to show it in the following format:
22 Jul 2014 00:04
According to the documentation, the server must send dates with the following format:
You can achieve that with this snippet:
Then, in the client side, you can format the date with SmartGWT: