Java Day of Week nextDayOfWeek(Date fromDate, int dow)

Here you can find the source of nextDayOfWeek(Date fromDate, int dow)

Description

next Day Of Week

License

Open Source License

Declaration

public static Calendar nextDayOfWeek(Date fromDate, int dow) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Calendar nextDayOfWeek(Date fromDate, int dow) {
        Calendar instance = Calendar.getInstance();
        if (fromDate != null) {
            instance.setTime(fromDate);/*from   www .j  av  a2s  .  c o m*/
        }
        if (dow > 0 && dow < 8) {
            int diff = dow - instance.get(Calendar.DAY_OF_WEEK);
            if (!(diff >= 0)) {
                diff += 7;
            }
            instance.add(Calendar.DAY_OF_MONTH, diff);
        }
        return instance;
    }
}

Related

  1. isWeekend(final Date date)
  2. isWeekendDay(final DayOfWeek nDayOfWeek)
  3. isWork(String weekday, Date date)
  4. javaCalendarToNewTimeApi(int dayOfWeek)
  5. mergeDayIntoDate(Date baseDate, int dayOfWeek)
  6. nextWeek(Date date)
  7. nextWeek(final Date date)
  8. previousWeek(long date)
  9. previousWeek(long date)