-7

Possible Duplicate:
Difference in days between two dates in Java?

I need to find difference between 2 dates. First one is in string format,

s1=2012-10-01T15:33:34.652905Z

I need to convert s1 into date d1 and then find the difference in integer between today's date d2 and d1.

How do I do this?

Community
  • 1
  • 1
ozzboy
  • 2,672
  • 8
  • 42
  • 69

1 Answers1

1

To convert your string to a date, you can use SimpleDateFormat.parse("yyyy-MM-dd'T'HH:mm:ss.SSSZ").

Given two Date objects, you can get whatever differences (days, seconds...) you need with JODA Time as advised in SO entry : Difference in days between two dates in Java?

Community
  • 1
  • 1
Michael Zilbermann
  • 1,398
  • 9
  • 19