• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to Compare to dates and get the difference

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
     
    Ranch Hand
    Posts: 456
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    pie. tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic