Forums Register Login
API methods for difference between two dates
Somebody please tell me why don't create the Sun create methods for calculate difference between two dates? Days between two dates for example.

I don't know why Sun didn't add that to the standard library. But calculating the difference between to dates is easy. You just look at the millisecond values of your two Date objects and subtract them - then you have the difference in milliseconds. It's straightforward to convert this to days (just divide by 24 * 60 * 60 * 1000, which is the number of milliseconds in one day).

This thread has been viewed 794 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 17, 2018 02:27:29.