Saturday, 23 April 2016

How to calculate days between two dates ?


Calculate days between two dates

Example
# Find out difference between two dates in milliseconds
long diff = secondDate.getTime() - firstDate.getTime();

# Find out days from milliseconds
System.out.println ("Days: " + diff / 1000 / 60 / 60 / 24);

No comments:

Post a Comment

Note: only a member of this blog may post a comment.