• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between 2 times  RSS feed

 
mythily prakash
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

please tell me the APIs used to find the differences b/w 2 times.That is,

start time:- 10:12:35
end time :- 10:12:48

How to do it?

or

Please explain it with a code!
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mythily,
i am not sure if we be have direct way of fining time differnce. Well as for i know you have java.util.GregorianCalendar Class which helps to achive what you intend too...
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
depends on your requirements...

if we talk about short intervalls of minutes or hours or so, just get the difference of the millis and recalculate to seconds, minutes, whatever

if we talk about intervalls of days, months, years (leap years!) take joda-time. (just google it)

concerning code examples: the philosophy of this forum is more to help learning than to provide solutions. so, better show us what you did already, and then get help from many friendly users here... :-)

best regards,
jan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!