Seems like we do not have this one yet, so here we go:
The Challenge
Write a program or function that takes a date as input and outputs the day number of the year. You may not use any builtins for that!
Rules
- As usual you may write a full program or a function.
- The format of the input is up to you, but it has to contain a year, a month and a day. Make clear which one your solution uses!
- No date-related builtins allowed! You gotta do the work by yourself. Builtins which are not related to date operations are fine.
- Base for the calcultion is the gregorian calendar.
- You have to take account of leap-years.
- You only need to handle years in the range [1, 9999]
- Standard loopholes are forbidden.
- Lowest byte count wins!
Testcases
Input format here is YYYY/MM/DD
2016/07/05 -> 187
2000/03/28 -> 88
0666/06/06 -> 157
6789/10/11 -> 284
0004/04/04 -> 95
1337/07/13 -> 194
Happy Coding!