Date nowDate=new Date();
Date yourPassDate=//you have a date here.
long now=nowDate.getTime();
long time=yourPassDate.getTime();
final long diff = now - time; //now you have a date interval representing with mileseconds.
//you can use this diff to do something like:
if (diff <1000*60)//less than one minute
//...
else if (diff <1000*60*60) //less than 1 hour
//...
else if (diff < 1000*60*60*24)//less than one day
//...
This is what java doc of Date.getTime() said:
* Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by this Date object.