Add 30 days to Date in java
<p>why when i add 30 days to today's day i got today's day - 30, and when i add 20 it adds??</p>

<p>here is a sample </p>

<pre><code>import java.text.DateFormat;
import java.util.Date;

public class DatePlus
{

    public static void main(String[] args)
    {
        Date now = new Date();
        Date now1 = new Date();
        Date now2 = new Date();
        DateFormat currentDate = DateFormat.getDateInstance();

        Date addedDate1 = addDays(now2, 20);
        Date addedDate2 = addDays(now1, 30);
        System.out.println(currentDate.format(now));
        System.out.println(currentDate.format(addedDate1));
        System.out.println(currentDate.format(addedDate2));
    }

    public static Date addDays(Date d, int days)
    {
        d.setTime(d.getTime() + days * 1000 * 60 * 60 * 24);
        return d;
    }
}
</code></pre>

<p>"this is the console"</p>

<pre><code>Jul 30, 2012
Aug 19, 2012
Jul 10, 2012
</code></pre>
