• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dates Difference  RSS feed

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have java application which needs to calculate the difference between 2 dates and excluding starting and ending date. Any code help please, its urgent one
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heres one method:
Store each date as a GregorianCalendar instance.
Use getTimeInMillis() on each instance then get the diffence between the two to give you the difference in milliseconds.
Convert this difference into days/hours/minutes/seconds with division and modulo.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!