Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Subtracting Dates in JAVA

 
Sam Drake
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anybody give me a code snippet to subtract dates in JAVA? The idea is to get the number of days between any 2 dates.
Thnx,
Sam.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam,
How about getting the difference in milliseconds:
d1.getTime() - d2.getTime();
Regards,
Manfred.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic