Quick and dirty, number of mins difference between 2 Date objects
(note this can be negative) ...
long minsDifference(Date testDate)
{
Date dateNow = new Date();
return (testDate.getTime() - dateNow.getTime()) / 1000;
}
There are lots of issues and corner cases with Dates and timezones so
be very careful.
Hope this helps
/Richard
On Jul 5, 3:34 am, Jake Colman <[email protected]> wrote:
> I have a Date variable which, according to the Javadoc, represents a
> specific moment in time. I need to compare that time with the current
> time so that I can do something if the current time is within X minutes
> of the time represented by the Date. How the heck can I figure this
> out? I know this is almost more of a Java question then it is an
> Android question but I'd appreciate any instance.
>
> Thanks.
>
> --
> Jake Colman -- Android Tinkerer
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en