DateTimeConverter implements Converter<Date, String> { @Override public Date toModelValue(final String widgetValue) { if (widgetValue == null || widgetValue.equals("")) { return null; } return DateUtils.createDate(widgetValue, DateUtils.getDateTimeFormatMask()); }  @Override Date toModelValue(final String widgetValue); @Override String toWidgetValue(final Date date); @Override Class<Date> getModelType(); @Override Class<String> getComponentType();  }
@Test public void testToModelValue() { Date date = converter.toModelValue("28/06/2017 13:51"); assertEquals(117, date.getYear()); assertEquals(5, date.getMonth()); assertEquals(28, date.getDate()); assertEquals(13, date.getHours()); assertEquals(51, date.getMinutes()); }