#1360
Number of Days Between Two Dates
pupil · 495 · lc easy +27 · verified · 52.4% accepted · 434 likes · top 42%
Description
Given two date strings in YYYY-MM-DD format, calculate and return the absolute number of days between them.
Example 1:
Input: date1 = "2019-06-29", date2 = "2019-06-30"
Output: 1
Example 2:
Input: date1 = "2020-01-15", date2 = "2019-12-31"
Output: 15
Code
1
2
3