Java Day of Week getWeekDay(Date dt, int weekDay)

Here you can find the source of getWeekDay(Date dt, int weekDay)

Description

get Week Day

License

Apache License

Declaration

public static Date getWeekDay(Date dt, int weekDay) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {

    public static Date getWeekDay(Date dt, int weekDay) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(dt);/*from  w ww  . j  a  v a 2s. c o m*/
        if (weekDay == 7)
            weekDay = 1;
        else
            weekDay++;
        cal.set(GregorianCalendar.DAY_OF_WEEK, weekDay);
        return cal.getTime();
    }
}

Related

  1. getWeekDay(Date d)
  2. getWeekDay(Date date)
  3. getWeekDay(Date date)
  4. getWeekDay(Date date)
  5. getWeekDay(Date date)
  6. getWeekDay(String strDate)
  7. getWeekdayDate(Date actualDate)
  8. getWeekdayInterval(Date date)
  9. getWeekDayOfYear(Date date)