Home > Mobile >  Build org.joda.time.DateTime with java.time.LocalDate and java.time.LocalTime or java.time.LocalDate
Build org.joda.time.DateTime with java.time.LocalDate and java.time.LocalTime or java.time.LocalDate

Time:05-16

So basically I have a DatePicker and TimePicker which will respectively give me a LocalDate and LocalTime. Now I want to use these values to make a org.joda.time.DateTime variable.

I'm not sure how to do that. I looked everywhere but I can't find a good answer to this all the answers I've found were for JPA which I'm not using.

CodePudding user response:

As per official documentation https://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html you can use DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) Constructs an instance from datetime field values using ISOChronology in the default time zone. The values for the constructor can be obtained from LocalDate and Localtime object https://docs.oracle.com/javase/8/docs/api/java/time/LocalTime.html https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html

  • Related