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,555
  • 29
  • 107
  • 179
  • 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
  • 232,312
  • 42
  • 391
  • 431
1

Use the Date Class

long diffInSec =    (newerDate.getTime() - olderDate.getTime())/1000;
Shamim Hafiz - MSFT
  • 20,466
  • 38
  • 110
  • 169