This works in all cases I have tested: regular days, 31st of a month, 28th of leap year February, January 1st (rolling back to December of the previous year). It just works and should be the accepted answer. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.