JDateChooser
has a getDate
method which returns a java.util.Date
. Once you have that, it's just a matter of using Java 8's Time API or JodaTime to calculate the difference
Java 8
LocalDateTime from = LocalDateTime.ofInstant(dateChooser_in.getDate().toInstant(), ZoneId.systemDefault());
LocalDateTime to = LocalDateTime.ofInstant(dateChooser_out.getDate().toInstant(), ZoneId.systemDefault());
Duration d = Duration.between(from, to);
System.out.println(d.toDays());
Joda-Time
LocalDate from = LocalDate.fromDateFields(dateChooser_in.getDate());
LocalDate to = LocalDate.fromDateFields(dateChooser_out.getDate());
System.out.println(Days.daysBetween(from, to).getDays());