javafx - How can i use org.joda.time.LocalDate and java.time.LocalDate at the same time; -


this question has answer here:

i'm practicing on how work dates. got stuck when want use javafx datepicker. since works java.time.localdate trying this.

    // here import java.time.localdate date datepicker;      localdate duedate = datepickerinvoiceduedate.getvalue();       int year = duedate.getyear();     int month = duedate.getmonthvalue();     int day = duedate.getdayofmonth();      //but here want import org.joda.time.localdate;      localdate duedatejt = new localdate(year, month, day); 

is there workaround ? , possible store localdate (joda time) inside mysql database ?

i found temporary fix not think right way ?

    java.time.localdate duedate = datepickerinvoiceduedate.getvalue();       int year = duedate.getyear();      int month = duedate.getmonthvalue();     int day = duedate.getdayofmonth();     //import org.joda.time.localdate;     localdate duedatejt = new localdate(year, month, day); 

i think u mean localdate duedatejt = new localdate(year, month, day); in "temporary fix" correct code.

if u want more definitive way of doing, suggest getting rid of joda time dates, since new java 8 dates have been implemented creator of joda time, find same functionnalities in similar api.

about inserting dates database, u can insert dates of type, provided u convert them java.sql.date (or java.sql.timestamp/java.sql.time) before.

for standard java.time.localdate, can : java.sql.date sqldate = java.sql.date.valueof(duedate);


Comments