Without understanding what you are really trying to do, the myCal.add(meCal.DATE,
5) statement adds 5 to DAY_OF_MONTH field.  Also the MONTH field seems to contain
values from 0-11.

Try this:
    Calendar myCal = Calendar.getInstance();
    System.out.println(myCal.get(myCal.DAY_OF_MONTH));
    myCal.add(myCal.DATE, 5);
    System.out.println(myCal.get(myCal.DAY_OF_MONTH));

See Ya.
--
Jay H. Lang
Chief Technologist
Distributed Computing Professionals Inc.
IBM Certified Specialist - MQSeries
303 277-1873 - Office
303 807-9700 - Cell

Alireza Nahavandi wrote:

> Hi all,
>
> I want to get the date of 5 days later. According to Sun Java document, the
> following code should work. But still the result is today.
> Am I missing anything?
>
>     Calendar myCal = Calendar.getInstance();
>     myCal.add(myCal.DATE, 5);
>
>     System.out.println ( myCal.DATE );
>
> Thank you.
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to