wood burning stoves 2.0*
The moose likes Java in General and the fly likes difference in days Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "difference in days" Watch "difference in days" New topic
Author

difference in days

asif Shaikh
Greenhorn

Joined: Jan 29, 2010
Posts: 2
How do I calculate the number of days left of a future date from the current date?
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3060
    
  38

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.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference in days