Java examples for java.util:Year
get Last Year Begin
//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(getLastYearBegin(year)); }/*from www. j a v a 2 s . com*/ public static Date getLastYearBegin(int year) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year - 1); calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); } }