Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

JavaFX DatePicker 📅

35.6K views on YouTube

javafx datepicker node tutorial example explained

#javafx #datepicker #date

// ************** Controller.java **************
package application;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;

public class Controller {

@FXML
private DatePicker myDatePicker;
@FXML
private Label myLabel;

public void getDate(ActionEvent event) {

LocalDate myDate = myDatePicker.getValue();
String myFormattedDate = myDate.format(DateTimeFormatter.ofPattern(“MMM-dd-yyyy”));
myLabel.setText(myFormattedDate);
}
}