Zach Sugano Zach Sugano - 1 year ago 92
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download