• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calculating Days

 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respected Sirs,

What is the best way for calculating number of days between two dates(java.util.Date object) ?

Thanks
Francis
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use java.util.Calendar:
 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wrong code:
please provide inputs "04/06/2008" and "05/09/2008".
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which produces 93, just like Visual Basic's DateDiff function does.
Well, that, is, using dd/MM/yyyy as the format. Otherwise it's 33, just like Visual Basic's DateDiff function does
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic