• 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

comparing two java.utillDate() objects

 
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a java.util.Date object with a date, and i need to compare how many days difference from current date, so how should i solve this.

essentially they should be in java.util.Date not in calendar.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many ways to accomplish this: http://www.google.com/search?q=java+days+between+dates
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ilias basha wrote:essentially they should be in java.util.Date not in calendar.


You are definitely going to need java.util.Calendar for this, as it is the only class* that knows all about nasty things like daylight savings time.

If you can't find anything on Google you can also search this forum, this question has popped up before.


* Perhaps Joda can do it as well but I have no experience with that.
 
reply
    Bookmark Topic Watch Topic
  • New Topic