Thirty days has September,
April, June, and November,
All the rest have thirty-one except February,
Which has four and twenty-four,
'til leap year gives it one day more.
Yes, this is the way I remember. My wife quotes the rhyme and I annoy her by pointing out the following issues:
1 - 3 lines of the rhyme at the end are utterly pointless as it's much easier to just remember that leap years are actually a thing.
2 - The fact that it rhymes doesn't help you remember which months you're talking about. It could quite easily be, "30 days hath September; October, November, December" and it would still rhyme but be wrong.
All the rest have thirty-one except February alone which has twenty-eight;
Except on every fourth year, when it has 29;
Except on years divisible by 100, when it has 28 again;
Unless the year is also divisible by 1000, when it's back to 29.