• How is this not better?

    Select day(dateadd(mm,DateDiff(mm, -1, getdate()),0) -1)