I solved this by creating my own ‘CustomTable’ subclass overrides a method as below:
/**
* Formats table cell property values. By default the property.toString()
* and return a empty string for null properties.
*
* @param rowId
* the Id of the row (same as item Id).
* @param colId
* the Id of the column.
* @param property
* the Property to be formatted.
* @return the String representation of property and its value.
* @since 3.1
*/
@Override
protected String formatPropertyValue(Object rowId, Object colId,
Property property) {
if (property == null) {
return "";
}
if(property.getType().equals(java.util.Date.class)){
return getDateFormatter().format((java.util.Date)property.getValue());
}
return property.toString();
}
private FastDateFormat getDateFormatter(){
if(dateFormatter != null){
return dateFormatter;
}
Locale locale = getParent().getApplication().getLocale();
dateFormatter = FastDateFormat.getInstance("EEE d MMM yy", locale);
return dateFormatter;
}
Just make
dateFormatter
an instance field in your own Table subclass. You should use your own format string.
Now, I’m sorting out how to deal with timezone info. Thinking of just making a GMT offset, and asking users to enter this info.