Since java.sql.Date is a subClass of java.util.Date following should
work

Calendar cal = new Calendar(new Date());
cal.add(Calendar.DAY_OF_MONTH,-10);
Date before10Days = cal.getTime();
if ( sqldate.before (before10Days) )
{
        do sth.
}


/*************************/
 Thomas Schuchert
 Cyberconsult
 Beratungsgesellschaft f�r Neue Medien mbH
 [EMAIL PROTECTED]
 030 - 39 99 05 46
/*************************/


> -----Urspr�ngliche Nachricht-----
> Von:  Sunita Sairaman [SMTP:[EMAIL PROTECTED]]
> Gesendet am:  Mittwoch, 5. April 2000 17:46
> An:   [EMAIL PROTECTED]
> Betreff:      Date diff
>
> hi,
>
> Problem: I have a date from MS SQL Database as
> java.sql.Date sqlDate=rs.getDate(3)
> which gives me date as 2000-04-05.
>
> I want to compare it with today's date and get the
> difference between today's date and sqlDate.  If it
> is more than say 10 days then I do something.
>
> How do I compare the 2 dates & get the difference in number of days.
>
> ~Sunita
>
>
> ____________________________________________________________________
> Get free email and a permanent address at
> http://www.netaddress.com/?N=1
>
> ______________________________________________________________________
> _____
> 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