I am trying to use dateField to display which year, month or day were selected on the calendar.
public DateField getDateField() {
dateField = new DateField("dateField", DateField.DATE);
dateField.setDate(new java.util.Date(System.currentTimeMillis()));
}
Then I would like to use this code, but instead of the long date "Thu Oct 07 00:00:00 GMT + 02: 00 2010" I would just like to see which month was selected, for example, "October" or "10" and so on. .d.
String month = dateField.getDate().toString();
System.out.println("Selected month: " + month);
I cannot find anything good on this date. I want to get a short date, for example, "2010-10-05" if that date was selected in the date field.
source
share