“Thirty days hath September, April, June and November,” runs the children’s mnemonic, “all the rest have 31, except February, which has 28.”
The reason months have different numbers is that when the Romans under Julius Caesar invented the Julian calendar they decided to give months with religious significance 31 days and ones of lesser importance 30 days. Thus January named after the god Janus, March after Mars, and July in honor of Caesar himself, are among the months with 31 days.
Caesar’s successor, Augustus, named August after himself and naturally, gave it 31 days. In order to do so he borrowed a day from February and reduced the length of that month to 28 days. Then, to avoid a succession of three long months, Augustus made September and November 30-day months and lengthened the alternate months of October and December to 31 days.