Just to show you that algorithms can come from the most bizarre places...
At lunchtime I was flipping through the Oxford Dictionary of Nursery Rhymes (don't ask), when I came across the nursery rhyme -- or, more accurately, the mnemonic -- that describes the numbers of days in each month:
Thirty days hath September,
April, June, and November;
All the rest have thirty-one,
Excepting February alone,
And that has twenty-eight days clear
And twenty-nine in each leap year.
I learned this one when I was young, probably at the same time I was learning how to tell the time from a clock. (A clock with hands, that is.) I'm fairly sure you're going to be familiar with it.
The entry went on to talk about the derivation of this particular mnemonic, and quoted a remarkable French ditty from the 13th century which might be the ancestor of the rhyme. The last sentence of the entry caught my eye though: "Another juvenile way of discovering the number of days is along the knuckles of the hand." It gave no explanation apart from that, but I had never heard of this method or algorithm before. So I did some research.
You might already know this, but it's a fun one. Form a fist with your left hand and position it so you can see the knuckles easily. Using the index finger of your right hand and starting at the leftmost knuckle, tap the knuckles and the dips between the knuckles as you recite the month names: January, February, March, etc. When you get to July and the last knuckle, start over from the leftmost knuckle again with August. The months that are on the knuckles have 31 days (they're 'taller'). The months in the dips have 30 days (they're 'shorter'), and you just have to remember that February actually has 28/29 days.
By the way, the reason for February having this weird arrangement, and not, say, December, is that the Romans started their year with March and so February was at the end of their year. (Hence September, October, November, and December being derived from the Latin for seventh, eighth, ninth, and tenth.) It was easier to add or take away days from the last month, and indeed this is what Augustus did to August: he ordained that August should have 31 days, not 30, and took it away from February. August was "his" month, you see, and it couldn't be shorter than Julius Caesar's month, July. Thank heavens he didn't make it 32 days in length instead to be one better.
Anyway, there you are: your algorithm for the day.