• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Compare to dates and get the difference  RSS feed

 
Rajesh Kannan Gurusamy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one guide me to compare to dates and get the difference.I can use before or after method to check the date is before the date passed as argument.is there any other method to get the difference?
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch...

Take a look at these articles from JavaWorld. They should help.
  • Calculating Java dates
  • Working in Java time : Learn the basics of calculating elapsed time in Java


  • You can also look at JavaAlmanac.com for some date examples.

    In the past, I have recommended those articles to posters that asked very similar questions. They have consistently found the articles useful and were able to come up with solutions to their problems. If after reading the articles, you still have some questions, please post them and some one can assist you further.

    I hope that helps.
     
    Jan Groth
    Ranch Hand
    Posts: 456
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    if you have to go knee-deep into details, like leap-years and summer/winter-time, i made very good experiences with joda-time. that's an open-source framework, and can be found here.

    hope it helps,
    jan
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!