Python 3, 60 55 51 bytes, 1-based month
lambda
function that accepts the month (1-based) and the day.
-5 bytes: used a "31-days" default month, and the list s accounts for the cumulate (absolute) difference between the actual days of months and 31
-4 bytes: the list is removed from the function parameters, thanks to @Hunaphu and @mic_e
lambda m,d,a=[3,0,3,2,3,2,3,3,2,3,2]:28*(m-1)+sum(a[:m-1])+d # original version
lambda m,d,s=[0,0,3,3,4,4,5,5,5,6,6,7]:31*m-31-s[m-1]+d
lambda m,d:31*m-31-[0,0,3,3,4,4,5,5,5,6,6,7][m-1]+d
Try it online!
Explanation (original version):
m,d
: input month and day
a[...]
: list of days to add to the "base" 28-day month, from january to novemeber, passed as optional argument
28*(m-1)
: the total number of days in the previous "28-days" months
+sum(a[:m-1])
: add the remaining days of the previous months (as difference actual days - 28)
+d
: add the days of the selected month
Python 3, 56 50 46 bytes, 0-based month
-4 bytes (compared to 1-based month number): if 0-based month number is allowed as input
-6 bytes: used the "31-days" approach
-4 bytes: the list is removed from the function parameters, thanks to @Hunaphu and @mic_e
lambda m,d,a=[3,0,3,2,3,2,3,3,2,3,2]:28*(m)+sum(a[:m])+d # original version
lambda m,d,s=[0,0,3,3,4,4,5,5,5,6,6,7]:31*m-s[m]+d
lambda m,d:31*m-[0,0,3,3,4,4,5,5,5,6,6,7][m]+d
0
for January,1
for February etc.)? \$\endgroup\$