Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Servlet Interest »

R: How to inc a date using java.util.calender or java.util.date

RBonazzo

2004-07-30

Replies:

Hi
Normaly I use this method

Calendar calFine = Calendar.getInstance();
calFine.setTime(Date1);
Calendar calInizio = Calendar.getInstance();
calInizio.setTime(Date2);
long diffDate = ((calFine.getTimeInMillis() - calInizio.getTimeInMillis())
/86400000);

A day is 86400000 ms
diffDate contain the difference in day between Date1 and Date2

Regards

Rinaldo

-----Messaggio originale-----
Da: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:SERVLET-INTEREST@(protected)
Inviato: venerdì 30 luglio 2004 10.07
A: SERVLET-INTEREST@(protected)
Oggetto: How to inc a date using java.util.calender or java.util.date

hai,

i have a problem like this.


i get startdate and enddate, and i must to minus that date to get n day.
After date i must add a startdate by 1 to show a date between startdate
and enddate.

this my partial code

int test = calendarTo.get(calendarTo.DAY_OF_YEAR) -
calendarFrom.get(calendarFrom.DAY_OF_YEAR);
int i = 0;
while(i<test){
//i do not know how to implement a code to show a date between startdate
and enddate
}


TIA,
andy

___________________________________________________________________________
To unsubscribe, send email to listserv@(protected)
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 listserv@(protected)
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
©2008 junlu.com - Jax Systems, LLC, U.S.A.