• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calculating days between 2 dates.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added code tags, so that the code is readable now. (Could you do that yourself in future?)
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic