1360. Number of Days Between Two Dates
https://leetcode.com/problems/number-of-days-between-two-dates/
Last updated
Was this helpful?
https://leetcode.com/problems/number-of-days-between-two-dates/
Last updated
Was this helpful?
Write a program to count the number of days between two dates.
The two dates are given as strings, their format is YYYY-MM-DD
as shown in the examples.
Example 1:
Example 2:
给两个以xxxx-xx-xx为格式的日期(>=1971年),问它们之间相差多少天。计算两个日期分别与1971年1月1日差了多少天。对给定日期计算在它的年是第几天,再从1971数到该年差了多少年,对每年是闰年加366年否则加365天。
代码参考自。