Java Year Day getLastDayOfTheYear(int year)

Here you can find the source of getLastDayOfTheYear(int year)

Description

get Last Day Of The Year

License

Open Source License

Declaration

public static Date getLastDayOfTheYear(int year) 

Method Source Code


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

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

public class Main {
    public static Date getLastDayOfTheYear(int year) {

        // get last day of the year
        Calendar lastDayOfThisYear = Calendar.getInstance();
        lastDayOfThisYear.clear();//from  w  ww. java  2s  . c  om
        lastDayOfThisYear.set(Calendar.YEAR, year);
        lastDayOfThisYear.set(Calendar.DAY_OF_YEAR, 1);
        lastDayOfThisYear.add(Calendar.YEAR, 1);
        lastDayOfThisYear.add(Calendar.MILLISECOND, -1);

        return lastDayOfThisYear.getTime();
    }
}

Related

  1. getCurrYearFirstDay(int year)
  2. getFirstDay4CurrentYear()
  3. getFirstDayOfThisYear()
  4. getLastDayOfYear(int year)
  5. getLastDayOfYear(int year)
  6. getTodayYear()
  7. getWeekNumOfYearDay(String strDate)