Wednesday, July 13, 2005
Difference Between Stacked Bob Graduated Bob
[Java] difference in days between two dates
This function calculates the difference in days between two dates. Taking as an example of initial date on January 1, 2000 and end date on January 10, 2000, the result returned by the function will be equal to '9 '.
public
long difDiasEntre2fechas (int Y1,int M1,int D1,int Y2,int M2,int D2){
new java.util. GregorianCalendar (Y1,M1,D1);
java.util.GregorianCalendar date2= new java.util. GregorianCalendar (Y2,M2,D2);
long difms=date2. getTimeInMillis () - date1. getTimeInMillis ();
long difd=difms / ( 1000 * * 60 60 24 * )
DIFD return;
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment