I would have one just simple question: How to convert from joda DateTime to LocalDate?
I have tried it like this but with no success:
final LocalDate startDate = LocalDate.ofEpochDay(start.getMillis());
public class DateUtils {
    /**
     * Convert {@link java.time.LocalDate} to {@link org.joda.time.DateTime}
     */
    public DateTime toDateTime(LocalDate localDate) {
        return new DateTime(DateTimeZone.UTC).withDate(
                localDate.getYear(), localDate.getMonthValue(), localDate.getDayOfMonth()
        ).withTime(0, 0, 0, 0);
    }
    /**
     * Convert {@link org.joda.time.DateTime} to {@link java.time.LocalDate}
     */
    public LocalDate toLocalDate(DateTime dateTime) {
        DateTime dateTimeUtc = dateTime.withZone(DateTimeZone.UTC);
        return LocalDate.of(dateTimeUtc.getYear(), dateTimeUtc.getMonthOfYear(), dateTimeUtc.getDayOfMonth());
    }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With