# z80 Machine Code, 13 bytes

    47 1F 1F 1F A8 E6 01 05 10 01 3D C6 30

Takes input (starting at 1) in the A register and stores output in the same register. This was manually assembled from the ez80 manual and is not yet tested, therefore it might contain some mistakes.

**Explanation:**

    47        ld b, a         ; Copy the value to the B register
    1F 1F 1F  rra   (3 times) ; \ Set A to ((A >> 3) ^ B) & 1, which is
    A8        xor a, b        ; | equal to 1 on all months with 31 days
    E6 01     and a, 1        ; / 
    05        dec b           ; \ Decrement the B register twice and skip the next instruction if 
    10 01     djnz $+3        ; / the resulting value is not zero (if the month is not february)
    3D        dec a           ; Decrement A (if february)
    C6 30     add a, 30       ; Add 30 to A