If you have to do the same trick in several places maybe it would be better to use James' solution. Or role a classes like
public abstract class FormatedDateModel extends Model<String> { private static final long serialVersionUID = 1L; private IModel<Date> model; public FormatedDateModel(IModel<Date> model) { this.model = model; } @Override public String getObject() { return getFormat().format(model.getObject()); } protected abstract DateFormat getFormat(); } public class MyFormatedDateModel extends FormatedDateModel { private static final long serialVersionUID = 1L; public FormatedDateModel(IModel<Date> model) { super(model) } protected DateFormat getFormat(){ return DATE_FORMAT; } } So, that you have @Override protected IModel createLabelModel(IModel rowModel) { return new MyFormatedDateModel (new PropertyModel<Date>(rowModel, getPropertyExpression())); } Best, Ernesto On Fri, Oct 30, 2009 at 3:13 PM, zabian <zabia...@gmail.com> wrote: > It worked out. > My solution is: > private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; > private static final SimpleDateFormat sdf = new > SimpleDateFormat(DATE_FORMAT); > > ... > @Override > protected IModel createLabelModel(IModel rowModel) { > return new Model<String>(sdf.format(new > PropertyModel<Date>(rowModel, getPropertyExpression()).getObject())); > } > > Thank you for help. > > Regards, > > Wojtek > > Ernesto Reinaldo Barreiro pisze: > >> Are you using PropertyColumn? If yes... Why not override >> >> >> protected IModel<?> createLabelModel(IModel<T> rowModel) >> { >> return new PropertyModel(rowModel, propertyExpression); >> } >> >> >> and return a model that formats the date as you need? >> >> Best, >> >> Ernesto >> >> 2009/10/30 zabian <zabia...@gmail.com> >> >> >> >>> Hi there, >>> i would like to find out if the date format for java.util.Date property >>> is >>> customizable in DataTable. >>> Could anyone point me how to set it? >>> >>> Regards, >>> Wojtek >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >>> >>> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >