Zach Sugano Zach Sugano - 1 month ago 8
Java Question

Check if one date is exactly 24 hours or more after another

I am using the compareTo method in Java to try and check if a certain date is greater than or equal than 24 hours after another date.

How do I determine what integer to compare the date to?

Answer

24h in milis => 24(h)*60(min)*60(sec)*1000(milis) so you can just check if difference between dates in milliseconds is greater then 86400000.