Java Day of Week getMondayOfWeek(Date date)

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

Description

get Monday Of Week

License

Apache License

Declaration

public static Date getMondayOfWeek(Date date) 

Method Source Code

//package com.java2s;
/*/*from  w w  w .  java 2 s  . co m*/
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

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

public class Main {
    public static final int FIRST_DAY_OF_WEEK = Calendar.MONDAY;

    public static Date getMondayOfWeek(Date date) {
        Calendar monday = Calendar.getInstance();
        monday.setTime(date);
        monday.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        monday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        return monday.getTime();
    }
}

Related

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