last Day Of Year - Java java.util

Java examples for java.util:Year

Description

last Day Of Year

Demo Code


//package com.java2s;

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

public class Main {
    public static void main(String[] argv) throws Exception {
        Date currentDate = new Date();
        System.out.println(lastDayOfYear(currentDate));
    }//w w w.j av  a2 s  .  c  o  m

    public final static Date lastDayOfYear(Date currentDate) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(currentDate);
        calendar.set(Calendar.MONTH, 11);
        calendar.set(Calendar.DAY_OF_MONTH, 31);
        return calendar.getTime();
    }
}

Related Tutorials