• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference in days  RSS feed

 
asif Shaikh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I calculate the number of days left of a future date from the current date?
 
Devaka Cooray
Marshal
Posts: 5521
690
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using java.util.Date,
futureDay.getTime() - today.getTime() returns the number of milliseconds between today and the 'future'.
Do some maths to get the number of days from it.
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except that doesn't work with Daylight Savings Time.

Search this forum, this question has been asked and answered (among others by me) several times before.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!