Java Day of Week getLastDayOfTheWeek(Date date)

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

Description

get Last Day Of The Week

License

Apache License

Declaration

public static Date getLastDayOfTheWeek(Date date) 

Method Source Code

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

import java.util.Calendar;

import java.util.Date;

import java.util.Locale;

public class Main {
    private static final int HOURS_OF_DAY = 23;

    public static Date getLastDayOfTheWeek(Date date) {
        Calendar calendar = Calendar.getInstance(Locale.CHINA);
        calendar.setTimeInMillis(date.getTime());
        calendar.set(Calendar.DAY_OF_WEEK, 7);
        calendar.set(Calendar.HOUR_OF_DAY, HOURS_OF_DAY);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        return new Date(calendar.getTimeInMillis());
    }/*ww  w .  j  a  v  a  2s .  c  o m*/
}

Related

  1. getIntervalIncludeWeekend(Date date)
  2. getISO8601WeekOfYear(Date date)
  3. getIsoDayOfWeek(Date date)
  4. getIsoWeek(java.util.Date date)
  5. getLastDayFromLastWeek(Date d)
  6. getLastDayOfWeek(Date date)
  7. getLastDayOfWeek(Date date)
  8. getLastDayOfWeek(Date date)
  9. getLastDayOfWeek(Date date)