Day of the Year Problem

Day of the Year Problem — ExecCode Easy DSA Practice

Solve the Day of the Year problem on ExecCode. Free online easy DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.

Problem description

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

Examples

Input {"date": "2019-01-09"}; Output 9. Input {"date": "2019-02-10"}; Output 41

Constraints

date.length == 10 date[4] == date[7] == '-', and all other date[i]'s are digits date represents a calendar date between Jan 1^st, 1900 and Dec 31^st, 2019.

Practice Day of the Year free on ExecCode. Browse DSA problems, topic map, and placement guides.