This rhyme will help you remember “Thirty days hath November, April, June, and September. February hath twenty-eight alone. And all the rest have thirty-one.” Your system will calculate the same result using 1D+1M-1D as a reliable formula for the last day of any given month.