Class DatePicker

java.lang.Object
All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class DatePicker extends ComboBoxBase<LocalDate>
The DatePicker control allows the user to enter a date as text or to select a date from a calendar popup. The calendar is based on either the standard ISO-8601 chronology or any of the other chronology classes defined in the java.time.chrono package.

The value property represents the currently selected LocalDate. An initial date can be set via the constructor or by calling setValue(LocalDate). The default value is null.

 DatePicker datePicker = new DatePicker();
 datePicker.setOnAction(e -> {
     LocalDate date = datePicker.getValue();
     System.err.println("Selected date: " + date);
 });
Image of the DatePicker control

The chronology property specifies a calendar system to be used for parsing, displaying, and choosing dates. The value property is always defined in the ISO calendar system, however, so applications based on a different chronology may use the conversion methods provided in the Chronology API to get or set the corresponding ChronoLocalDate value. For example:

LocalDate isoDate = datePicker.getValue();
 ChronoLocalDate chronoDate =
     ((isoDate != null) ? datePicker.getChronology().date(isoDate) : null);
 System.err.println("Selected date: " + chronoDate);
Since:
JavaFX 8.0