Calculate the day number of the year 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 -&gt; 187
2000/03/28 -&gt; 88
0666/06/06 -&gt; 157
6789/10/11 -&gt; 284
0004/04/04 -&gt; 95
1337/07/13 -&gt; 194


Happy Coding!
JavaScript ES6, 81 69 bytes

(y,m,d)=&gt;d+parseInt("03479cehkmpr"[--m],36)+m*28-(y%(y%25?4:16)&amp;&amp;m&gt;1)


Assuming months are 1-based, otherwise I could save 2 bytes.

Edit: Saved 12 bytes using @user81655's tip.