Java LocalDateTime Calculate calcNextDayOfWeekFromLDT(LocalDateTime ldt, DayOfWeek dow)

Here you can find the source of calcNextDayOfWeekFromLDT(LocalDateTime ldt, DayOfWeek dow)

Description

Like it says

License

Open Source License

Parameter

Parameter Description
ldt a parameter
dow a parameter

Exception

Parameter Description
Exception an exception

Declaration

public static LocalDate calcNextDayOfWeekFromLDT(LocalDateTime ldt, DayOfWeek dow) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.time.*;

import java.time.temporal.TemporalAdjusters;

public class Main {
    /**/*from  w w w.ja  v a 2  s.  c om*/
     * Like it says
     *
     * @param ldt
     * @param dow
     * @return
     * @throws Exception
     */
    public static LocalDate calcNextDayOfWeekFromLDT(LocalDateTime ldt, DayOfWeek dow) throws Exception {
        LocalDate d = ldt.toLocalDate();
        return calcNextDayOfWeek(d, dow);
    }

    /**
     * Find the next day of the week from the given LocalDate
     *
     * @param d
     * @param dow
     * @return
     */

    public static LocalDate calcNextDayOfWeek(LocalDate d, DayOfWeek dow) throws Exception {
        return d.with(TemporalAdjusters.next(dow));
    }
}

Related

  1. addHeureMinute(final LocalDateTime time, final int heures, final int minutes)
  2. areDatesOneMonthApart(LocalDateTime start, LocalDateTime end)
  3. atMidnight(LocalDateTime value)
  4. balanceStartAndEndDateTime(LocalDateTime startDateTime, LocalDateTime endDateTime)
  5. before(LocalDateTime time1, LocalDateTime time2)
  6. ceilDate(LocalDateTime dateTime)
  7. checkIfTimeExist(LocalDateTime date)
  8. clampDateTimeWithMaxAllowedHour(LocalDateTime dateTime, int maxAllowedHour)
  9. convertDatabaseDateToUSTime(LocalDateTime databaseDate)