1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/一年中的第几天 [day-of-the-year].html
2022-03-29 12:43:11 +08:00

28 lines
876 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个字符串&nbsp;<code>date</code> ,按 <code>YYYY-MM-DD</code> 格式表示一个 <a href="https://baike.baidu.com/item/公元/17855" target="_blank">现行公元纪年法</a> 日期。返回该日期是当年的第几天。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>date = "2019-01-09"
<strong>输出:</strong>9
<strong>解释:</strong>给定日期是2019年的第九天。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>date = "2019-02-10"
<strong>输出:</strong>41
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>date.length == 10</code></li>
<li><code>date[4] == date[7] == '-'</code>,其他的&nbsp;<code>date[i]</code>&nbsp;都是数字</li>
<li><code>date</code> 表示的范围从 1900 年 1 月 1 日至 2019 年 12 月 31 日</li>
</ul>