1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/日期之间隔几天 [number-of-days-between-two-dates].html

26 lines
705 B
HTML
Raw Permalink Normal View History

2022-03-27 20:37:52 +08:00
<p>请你编写一个程序来计算两个日期之间隔了多少天。</p>
<p>日期以字符串形式给出,格式为&nbsp;<code>YYYY-MM-DD</code>,如示例所示。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>date1 = &quot;2019-06-29&quot;, date2 = &quot;2019-06-30&quot;
<strong>输出:</strong>1
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>date1 = &quot;2020-01-15&quot;, date2 = &quot;2019-12-31&quot;
<strong>输出:</strong>15
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li>给定的日期是&nbsp;<code>1971</code>&nbsp;年到 <code>2100</code>&nbsp;年之间的有效日期。</li>
</ul>