Java examples for java.util:Year
get Last Year End
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { int year = 2; System.out.println(getLastYearEnd(year)); }//from ww w.j a v a2 s . c o m public static Date getLastYearEnd(int year) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year - 1); calendar.set(Calendar.MONTH, 11); calendar.set(Calendar.DAY_OF_MONTH, 31); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return calendar.getTime(); } }