Re: Subtracting a day from java.sql.Date
Martin Sunder Singh D Samuel <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <000901c31f5d$b04753f0$1b0205c0@Martin> |
Hi !
This is not much relevent to your requirement, but I believe it will be
helpful !
java.sql.Date dt0 = new java.sql.Date(103,2,21);
java.util.Date dt1 = new java.util.Date();
long diff = dt1.getTime() - dt0.getTime();
System.out.println(diff/(24*60*60*1000)); // No of days between dt1 and
dt0
Thanks,
Martin Sunder Singh D Samuel
MEDICOM Solutions (P) Ltd.
73-D, Electronics City, Hosur Road,
Bangalore - 561 229, INDIA.
Tel : +91-80-8520230/29 Extension : 143
Mob : +91-94480-62309
visit us : http://www.medicomsoft.com
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[email protected]]On Behalf Of Kenny
G. Dubuisson, Jr.
Sent: Wednesday, May 21, 2003 1:24 AM
To: [email protected]
Subject: Subtracting a day from java.sql.Date
Hello all. I'm trying to subtract a day from a java.sql.Date class
variable. Looking at the java docs, there is no method to do this. All the
date modification methods belong to another class, java.util.Calendar. To
be able subtract a day from my class, should I convert it to the Calendar
class and then back to the Date class or is there something easier that I'm
missing. My main requirement is to have it in a java.sql.Date class when
done. Any example code would be much appreciated (I have to admit I'm still
a lightweight in Java).
Thanks,
Kenny
___________________________________________________________________________
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