Ordinal date

An ordinal date is a calendar date typically consisting of a year and a day of year ranging between 1 and 366 (starting on January 1), though year may sometimes be omitted. The two numbers can be formatted as YYYY-DDD to comply with the ISO 8601 ordinal date format.

For these purposes it is convenient to count January and February as month 13 and 14 of the previous year, for two reasons: the shortness of February and its variable length. In that case the date counted from 1 March is given by

Again counting January and February as month 13 and 14 of the previous year, the date counted from 1 March is modulo 7 equal to

floor (2.6 m − 0.4 ) + d

with m the month number and d the date.

Calculation can be done starting with January 1 mathematically without if statements if we take advantage of min and max algebraic logic
MAX is 1/2*(a+b+|a-b|)
MIN is 1/2*(a+b-|a-b|)

provided the month(m) day(d) and year(y)
(MAX(0,MIN(1,m-1))*31)+ //if Jan is a full month
(MAX(0,MIN(1,m-2))*28)+ //if Feb is a full month
(MAX(0,MIN(1,m-3))*31)+ //if Mar is a full month
(MAX(0,MIN(1,m-4))*30)+ //if Apr is a full month
(MAX(0,MIN(1,m-5))*31)+ //if May is a full month
(MAX(0,MIN(1,m-6))*30)+ //if June is a full month
(MAX(0,MIN(1,m-7))*31)+ //if July is a full month
(MAX(0,MIN(1,m-8))*31)+ //if Aug is a full month
(MAX(0,MIN(1,m-9))*30)+ //if Sept is a full month
(MAX(0,MIN(1,m-10))*31)+ //if Oct is a full month
(MAX(0,MIN(1,m-11))*30)+ //if Nov is a full month
d+ //days of current month
(((INT((y)/4)-INT((y)/100)+INT((y)/400)) //leap year logic
-(INT((y-1)/4)-INT((y-1)/100)+INT((y-1)/400)))*MAX(0,MIN(1,m-2))) //only count a leap year if date is >=3rd month //leap year logic