Java Calendar Day getMonday(Calendar calendar)

Here you can find the source of getMonday(Calendar calendar)

Description

get Monday

License

Open Source License

Declaration

public static Calendar getMonday(Calendar calendar) 

Method Source Code

//package com.java2s;
/**//w w w . j a  v a 2 s. c  o  m
* License: https://github.com/votingsystem/votingsystem/wiki/Licencia
*/

import java.util.Calendar;

public class Main {
    public static Calendar getMonday(Calendar calendar) {
        Calendar result = (Calendar) calendar.clone();
        result.add(Calendar.DAY_OF_YEAR, -7);
        result.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        result.set(Calendar.HOUR_OF_DAY, 24);
        result.set(Calendar.MINUTE, 0);
        result.set(Calendar.SECOND, 0);
        result.set(Calendar.MILLISECOND, 0);
        return result;
    }
}

Related

  1. getFirstDay(Calendar cal)
  2. getGregorianDay(Calendar cal)
  3. getJulianDay(Calendar currentDate)
  4. getLastDay(Date targetDate, Calendar cal)
  5. getLastDayOfPreviousPeriod(int startDayOfPeriod, Calendar cal)
  6. getNextDay(Calendar cal)
  7. getNextDay(Calendar calendar, int day)
  8. getNextMonday(Calendar date)
  9. getNoonOfDay(Date day, Calendar cal)