Day of the Year

題目

Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year.

Example 1:

Example 2:

Example 3:

Example 4:

Constraints:

  • date.length == 10

  • date[4] == date[7] == '-', and all other date[i]'s are digits

  • date represents a calendar date between Jan 1st, 1900 and Dec 31, 2019.

Last updated

Was this helpful?