2

Possible Duplicate:
Calculating the Difference Between Two Java Date Instances

time1: 17:05 time2: 17:08

I'd like to get the difference in seconds.

Community
  • 1
  • 1
lacas
  • 13,928
  • 30
  • 109
  • 183
  • 1
    Hopefully, internet does not yet exist in the timespace continuum. Elsewhere, I guess copy/pasting question title in google/bing/duckduckgo would bring you an anwser. – Riduidel Dec 31 '10 at 10:19

2 Answers2

9
 long diffInMillis =    newerDate.getTime() - olderDate.getTime()

Must See

jmj
  • 237,923
  • 42
  • 401
  • 438
1

Use the Date Class

long diffInSec =    (newerDate.getTime() - olderDate.getTime())/1000;
Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176