Java Weekend getCurWeekEnd(String strDate)

Here you can find the source of getCurWeekEnd(String strDate)

Description

get Cur Week End

License

Apache License

Declaration

public static String getCurWeekEnd(String strDate) 

Method Source Code

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

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {

    public static String getCurWeekEnd(String strDate) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        dateFormat.parse(strDate, new ParsePosition(0));
        Calendar calendar = dateFormat.getCalendar();
        int day = calendar.get(Calendar.DAY_OF_WEEK);
        calendar.add(Calendar.DATE, 7 - day);
        return dateFormat.format(calendar.getTime());
    }// www. j a  va  2  s.  co m
}

Related

  1. endOfWeek(Date date, String format)
  2. getCalendarWeekOfDate(Date date)
  3. getWeekRange(String strBeginDate, String strEndDate, String pattern)
  4. isEndOfWeek()
  5. isWeekend(Calendar calendar)
  6. isWeekend(Calendar dateCal)