• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does this give me the number of days ?  RSS feed

 
Vishal Mungi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
matDt = df.parse(maturityDate);
valDt = df.parse(valueDate);
long millis = matDt.getTime()-valDt.getTime();
period=millis/(24*60*60*1000);

i dont know but this is only givin me the difference between the days
w/o taking into consideration the months etc.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't crosspost
 
Stian Almaas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that will give you the number of days. What is your question? Do you want the answer to be something like "2 months and 3 days"?
 
Vishal Mungi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry .. but got the solution anyway
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!