How to convert Joda Localdate to Joda DateTime?

后端 未结 1 652
没有蜡笔的小新
没有蜡笔的小新 2021-02-04 23:28

I\'m trying to simply add TimeZone information back into a LocalDate before performing some more calculations. The LocalDate came from using the ObjectLab LocalDateCalculator to

1条回答
  •  再見小時候
    2021-02-05 00:24

    There are various methods on LocalDate for this, including:

    • LocalDate::toDateTimeAtCurrentTime()
    • LocalDate::toDateTimeAtStartOfDay()
    • LocalDate::toDateTime( LocalTime )
    • LocalDate::toDateTime( LocalTime , DateTimeZone )

    You have to be explicit about what you want the time component to be in the resulting DateTime object, which is why DateTime's general-conversion constructor can't do it.

    0 讨论(0)
提交回复
热议问题