Hi Chris ,

please see following line of code
*****************************************
Calendar df_curr = Calendar.getInstance();
Calendar df = Calendar.getInstance();
----------
---------
Date dcurr =new Date(CurRec);

df_curr.setTime(dcurr);

***********************
so now i have two instances df and df_curr

one set to systime and next to some other time.
now i am extracting various values as
int month_curr = df_curr.get(Calendar.MONTH);

but i need to know exact difference irrespective of year between two dates
in days..

Can you please explain further..

sandarbh


----- Original Message -----
From: "chris brown" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 20, 2001 3:45 PM
Subject: Re: date problems


> You should be able to extract a Date object (using Calendar.getTime()) ,
> then from this Date, call getTime() to get a long (in milliseconds).  Do
the
> same for your other date, then compare the two long values.
>
> A day can generally be assumed to be equal to :
> 1000ms * 60s * 60m * 24h
>
> You may wish to set your two Calendar objects to 00:00:00.000
(hh:mm:ss.ms)
> before extracting the time to eliminate perhaps redundant information, or
> you could use modulus or or division operators (% or /) on the resulting
> long values for the same thing.  Depends upon what you need to do...
>
> In any case, this should work around any month or year boundary problems.
>
> -Chris
>
> ----- Original Message -----
> From: "sandarbh" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, April 20, 2001 1:37 PM
> Subject: date problems
>
>
> > Hi all,
> > I want to have exact difference in days for two days in Java. If for the
> > current year , then I am able to extract exact info using calender
class,
> > but across the years its not possible?? can any one suggest a better way
> > please??
> >
> > Thanks in anticipation.
> >
> > sandarbh
> >
> >
>
===========================================================================
> > 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://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> 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://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
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://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to