Search code examples
threetenbp

What's the best way to convert LocalDate and LocalTime to java.util.date?


I have a org.threeten.bp.LocalDate and a org.threeten.bp.LocalTime and I do need a java.util.date instance. Whats the best way to archieve this. I looked through DateTimeUtils but found no proper solution.


Solution

  • Life can be so easy:

    Date date = Date(localDate.year,localDate.monthValue,localDate.dayOfMonth,localTime.hour,localTime.minute, localTime.second)
    

    edit: oh wait.... this is deprecated! So another solution would be better!