Java Year Get getWeekStartEndDate(int timeInfo, String yearInfo)

Here you can find the source of getWeekStartEndDate(int timeInfo, String yearInfo)

Description

get Week Start End Date

License

Open Source License

Declaration

public static String[] getWeekStartEndDate(int timeInfo, String yearInfo) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

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

public class Main {
    public static String[] getWeekStartEndDate(int timeInfo, String yearInfo) {
        String[] startEndDate = new String[2];
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.set(Calendar.WEEK_OF_YEAR, timeInfo);
        cal.set(Calendar.YEAR, Integer.parseInt(yearInfo));
        SimpleDateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy");
        cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        startEndDate[0] = formatter.format(cal.getTime());
        cal.add(Calendar.DAY_OF_WEEK, 6);
        startEndDate[1] = formatter.format(cal.getTime());
        return startEndDate;
    }/*from w  ww .  j a v a2s  .  co  m*/
}

Related

  1. getThisYear()
  2. getThisYear()
  3. getTwoDigitYear()
  4. getTwoYearsBefore(int date)
  5. getWeekOfYear(Date date)
  6. getYear()
  7. getYear()
  8. getYear()
  9. getYear()