This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Calculating days between 2 dates. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calculating days between 2 dates." Watch "Calculating days between 2 dates." New topic
Author

Calculating days between 2 dates.

Al Do
Greenhorn

Joined: Oct 13, 2011
Posts: 5
I am having a problem with a simple program that calculates the number of days between two dates input. It keeps returning zero and I have no idea why I have tried many different attempts with the daysBetween method.




If any one could shed some light it would be much appreciated.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I added code tags, so that the code is readable now. (Could you do that yourself in future?)
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Al Do wrote:I am having a problem with a simple program that calculates the number of days between two dates input. It keeps returning zero and I have no idea why I have tried many different attempts with the daysBetween method.


Create a new program from scratch with no GUI stuff, no user input, nothing at all except the code to compute the difference between two hardcoded dates and print it out.


This will make it easier for you to test, debug, and modify your difference calculation code without other distractions, AND it will serve as an SSCCE(⇐click) that will make it easier for folks here to see what you're doing without unnecessary fluff if you need to post again for help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating days between 2 dates.
 
Similar Threads
How to get past date ?
Comparing two date inputs
Time-Date Conversion??
Prepared Statement and Date class - Problem still exists
Get Dates between the given dates.