Last I checked, February, being the second month, doesn't in fact have 31 days. If you expected that to be March, then you have an off by one error and you should add one to the month column before attempting to format it.
On the other, if you expect february to have 31 days, well, you have more problems then these perl ones!