Days Between Dates
Return the number of days between the first date (y1, m1, d1) and the second date (y2, m2, d2). The result is positive if the second date is later, negative if it is earlier and 0 if the dates are equal.
Example 1
y1 2024
m1 1
d1 1
y2 2024
m2 3
d2 1
returns 60
31 + 29 = 60 days (2024 is a leap year).
Constraints
1971 <= year <= 2100for both dates- Both dates are valid
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.