I would think that the results of such a calculation would not be very
accurate since months and years have varying lengths.

For instance, what would be the result of taking the difference of
11/30/2001 and 2/28/2001 ?
is it 9 months or 9 months and two days?

Regards,

Richard

At 04:28 PM 12/13/2001 -0700, you wrote:
>Is there any way to get the difference in year, month, day format?
>
>----- Original Message -----
>From: "Richard Yee" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, December 13, 2001 4:18 PM
>Subject: Re: date difference
>
>
> > You can first parse the strings using the DateFormat.parse() method to get
> > a Date object and then use the Date.getTime() method to return the # of
> > milliseconds from the epoch for each date.
> > Subtract the values returned by getTime().
> > Divide the result by (60 * 60 * 24 * 1000)  = (86400000) to get the # of
> > days difference.
> >
> > Regards,
> >
> > Richard
> >
> >
> > At 03:44 PM 12/13/2001 -0700, you wrote:
> > >Does someone have an example of how to calculate the date difference in
>java.
> > >
> > >For example I have these two dates
> > >date #1 [12/01/2001]
> > >date #2 [12/31/2002]
> > >
> > >How do I calculate the # of days apart from date #1 to date #2
> > >
> > >Need some guidiance~
> > >
> >
> >===========================================================================
> > >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
> >
>
>===========================================================================
>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