Adding days to the Given Date

One of my friend was breaking his head to add certain days to the given date in Java. Later I gave him the solution as below. I hope it will be helpful for you too. The source-code goes like this:


/**
 *
 * @author Prashant
 */
import java.util.*;
import java.text.*;
public class DateProg {
 static int day,month,year;
 public void reduceDate1(int d1,int m1,int y1)
 {
 Date dt = new Date();
 Calendar c = Calendar.getInstance();
 c.set(y1, m1, d1);
 // c.setTime(dt);
 c.add(Calendar.DATE, 364);
 c.add(Calendar.MONTH, -1);
 dt = c.getTime();
 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 String Date = dateFormat.format(dt);

 System.out.println(Date );
 }
 public static void main(String[] args) {
 DateProg obj= new DateProg();
 obj.reduceDate1(1,01,2004);
 }
}

Output
2004-12-30