Hi Renz,

    You can not get the difference between 2 date objects just  by
subtracting one from another.
You can get difference in milliseconds using date.getTime() method.

For example,
        Date dt1 ;
        Date dt2;
       //Initializing Dates
        ......................
        .....................

        long diff = dt1.getTime() - dt2.getTime();

        If you want to maintain some time difference between 2 dates, you
can do that by coverting that time in to millisenconds.

    For example if you want to maintain 2 hours of time difference,

        long wanted = 2*60*60*1000;

        if ( diff > wanted){
                .............................................
                .............................................
        }

    Is this helpful !?

Regards,
RaviShankar


----- Original Message -----
From: "Renz Daluz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 10:05 AM
Subject: Getting the difference between two dates


> Hi,
>
> Here is my problem, in every request on my servlet I log the date and
time.
> Now when I tried Date diff = Date2 - Date1 I got an error.  How do I get
the
> difference between to dates so that I can have to time between each
request.
>
> Thanks in advance
>
> Best regards,
>
> /Renz
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to