store current date and date 1 year from current in java

If you do not want to drag external libraries, just use calendar.add(Calendar.YEAR, 1)

Calendar cal = Calendar.getInstance();
Date today = cal.getTime();
cal.add(Calendar.YEAR, 1); // to get previous year add -1
Date nextYear = cal.getTime();

Note, if the date was 29/Feb/2012 and you added 1 year, you will get 28/Feb/2013

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)