| Author |
calculate duration between two dates
|
tejeshwar sahu
Greenhorn
Joined: Mar 16, 2005
Posts: 1
|
|
please give me solution how to calculate duration between two dates. its very arrgent. thanking you!
|
 |
Ko Ko Naing
Ranch Hand
Joined: Jun 08, 2002
Posts: 3178
|
|
Well, tradition way is to chnage them into milliseconds, using getTime() method of Date class, then after you got the difference back, change it back to Date... But there is another tool available out there which you don't need such thing to do... You might want to have a look at their site... http://joda-time.sourceforge.net Even though there is a need to compensate for the learning curve, you won't regreat using that... I always use that, whenever I have to deal with Date-related stuff in my work, since I know how to use them... I got to know about that here in the Ranch as well...
|
Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
|
 |
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
Well, tradition way is to chnage them into milliseconds, using getTime() method of Date class, then after you got the difference back, change it back to Date...
Change it back to date ? But why ? The difference should be in terms of x days and not date right? For e.g. What is the duration between today and saturday ? It will be 2 days and some hours , right.
|
Groovy
|
 |
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
Check this thread at the Sun forum http://forum.java.sun.com/thread.jspa?threadID=581338&messageID=2951168
|
 |
 |
|
|
subject: calculate duration between two dates
|
|
|