I'm retrieving two timestamps from a database (check_in and check_out). I need to compare the two to find out how many days have passed between the two timestamps. How can this be done in Java?
Just subtract check_out and check_in, and convert from whatever units you're in to days. Something like
//pseudo-code
diff_in_millis = Absolute Value Of ( check_out - check_in ) ;
diff_in_days = diff_in_millis / (1000 * 60 * 60 * 24);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With