This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Days between java.sql.Date and java.util.Date objects

 
Kop Ite
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have two objects one a java.sql.Date object and the other java.util.Date object.
I want to know the number of days between the two dates? How do I do this ?
If that is not possible, how do I convert the java.sql.Date object to a java.util.Date object ?
Please suggest.
Thanks
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, java.sql.Date extends java.util.Date so for the purposes of what you are doing, you can treat them both as java.util.Date objects.
Use the getTime() method for each object and subtract the difference. Divide that by the number of milliseconds in a day and you'll get your answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic