• Post Reply Bookmark Topic Watch Topic
  • New Topic

Re: Day Count  RSS feed

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I have an object of Calendar representing a day, let says 20040101. And I want to calculate the no. of days between 20040101 and today. How can I achieve it?

Thanks!
Joe
 
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So then if this is a "re" thread, what happened to the original "Day Count" thread.

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you would need to make another Calendar object for today, get the timestamp, and subtract one from the other, then divide by (1000 * 60 * 60 * 24) which is a day in milliseconds.

Mark
 
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So then if this is a "re" thread, what happened to the original "Day Count" thread.

Mark
--------------------

How to Ask Questions the Smart Way FAQ
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!