Java Year Day lastDayOfYear(Integer year)

Here you can find the source of lastDayOfYear(Integer year)

Description

last Day Of Year

License

Open Source License

Declaration

public static Date lastDayOfYear(Integer 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 lastDayOfYear(Integer year) {
        Date d = new Date();
        d.setMonth(11);//from   ww  w.j a v a2 s  . c o  m
        d.setYear(year - 1900);
        d.setHours(23);
        d.setMinutes(59);

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(d);
        int lastDate = calendar.getActualMaximum(Calendar.DATE);
        calendar.set(Calendar.DATE, lastDate);
        return calendar.getTime();
    }
}

Related

  1. getYearLastDay(String dateString)
  2. getYearWeek(String curday)
  3. getYearWeek(String curday)
  4. lastDay(Integer year, int month)
  5. lastdayofyear()
  6. todaysYear()