简体   繁体   中英

Build org.joda.time.DateTime with java.time.LocalDate and java.time.LocalTime or java.time.LocalDateTime

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM