I have a datetime in a variable previous. Now i want to check if the previous datetime is more than twenty minutes before the current time.
Date previous = myobj.getPreviousDate();
Date now = new Date();
//check if previous was before 20 minutes from now ie now-previous >=20
How can we do it?
Use
Or, more verbose, but perhaps slightly easier to read: