Formatting of date column

I use a table with a BeanItem Container. One bean property is a date type.

Binding:

itemContainer = new BeanItemContainer<MyItem>(MyItem.class);
		table.setContainerDataSource(itemContainer);

what is the best way to format the representation of the date values? I just want to get DD/MM/YYYY

With Table easiest option could be to overwrite the formatPropertyValue method so that for specific column it’ll give out the date in format you wish. This you can do with SimpleDateFormat for example.

Method will return String which will be positioned to the corresponding cell. This is just the output and should not affect for example the ordering.

Or do

table.setConverter(DATE_PROPERTY, new StringToDateConverter() {
            @Override
            protected DateFormat getFormat(Locale locale) {
                return DateFormat.getDateInstance(DateFormat.SHORT, locale);
            }
        });

Replace the format with whatever format you like to have. The above example uses a short date representation using the set locale.

thanks Artur! This works perfect for me!