Java Day of Week getMondayOfThisWeek(Date date)

Here you can find the source of getMondayOfThisWeek(Date date)

Description

get Monday Of This Week

License

Open Source License

Declaration


public static Date getMondayOfThisWeek(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static Date getMondayOfThisWeek(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);/*from  w  w  w  .  j a  va 2 s  . com*/
        int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
        if (day_of_week == 0)
            day_of_week = 7;
        c.add(Calendar.DATE, -day_of_week + 1);
        return c.getTime();
    }
}

Related

  1. getLastDayWeek(String s)
  2. getLastMondayOfWeek(Date date)
  3. getLastWeekDate(Date date)
  4. getLastWeekDay(int weekDay, Date end)
  5. getMondayFirstOfWeek(Date baseDate)
  6. getMondayOfWeek(Date date)
  7. getNext(final java.util.Date date, final int dayofweek)
  8. getNextClosestDateTime(DayOfWeek[] daysOfWeek, int hour, int min)
  9. getNextClosestDateTime(DayOfWeek[] daysOfWeek, int hour, int min)