Treebeard's Homepage : Stumpers

Treebeard's Stumper Answer
5 October 2001

Palindromic Dates

Thanks Donna, you pointed out that last Tuesday, October 2, 2001, was a palindromic date. Written in the usual American way (mm-dd-yyyy), that's 10-02-2001. The digits are the same forward and backward! The obvious stumper is when will this happen again, and when did it happen last? In Europe, they write dates as dd-mm-yyyy, so Tuesday was 02-10-2001. The International Standard is yyyy-mm-dd, so it was 2001-10-02. Which way of writing dates will produce the next palindromic date? What if we all decide to write yy instead of yyyy?

The next palindromic date after October 2, 2001 (10-02-2001) will be January 2, 2010 or 01-02-2010 (as mm-dd-yyyy). JP was the first Dunn Middle School student to figure that this last happened way back on August 31, 1380 or 08-31-1380. It's different if we write our dates as dd-mm-yyyy or yyyy-mm-dd, though both give the same result. (Why? D'oh!) The next reversible date will then be February 20, 2002 or 20-02-2002. There are many more reversible dates if we write the year as yy instead of yyyy. For example, yesterday was October 11, 2001 or 10-11-01.


Working back to the last palindromic mm-dd-yyyy date was the hard one. The constraint is that months can only be {1 to 12} and days can only be {1 to 28-31} depending on the month. So start working backwards.

10-022001this palindromic date
00-xx2000illegal month
xx-9119xxillegal day, same for 18xx, 17xx, 16xx, 15xx, 14xx
xx-3113xxpossible day, so refine it
01-311310possible, same for 1320, 1330, 1340, 1350, 1360
07-311370possible, and better
08-311380possible, and the best so far
09-311390looks good, but September only has 30 days so it's illegal
10-311301wups, it got lower, all done

Similar trial and error found the other answers.

Graybear sent this complete answer that considers some other conventions:

I noticed it on the first of the month. One of my students asked the date so I wrote it on the board as 10-1-01 and noticed that it was palindromic and made up of only 1s and 0s. By writing the date in this format (mm-d-yy or mm-dd-yy), the first nine days of this month, as well as the 11th and the 22 are palindromic; then we'll have to wait until 2-01-02 (except if you write the day as 01, you'ld probably write the month as 02 so, for the purists, the next date would be 01-11-10).

If you write the date as mm-dd-yyyy, the most recent date was 10-02-2001 the next date is 01-02-2010. As dd-mm-yyyy, the last date was 10-02-2001 (last February 10th), the next date is 20-02-2002 (next February 20th).

Using the yyyy-mm-dd format gives the same palindromes as mm-dd-yyyy! (Why? Duh!)

As for yy formats, I mentioned mm-dd-yy above, for dd-mm-yy, the most recent was in September, 10-9-01, the next in November, 10-11-01.

And, last but not least, is yy-mm-dd. It works the same as dd-mm-yy. This is the format I use for files that I update and want to know what "version" each one is without opening it. For example, if I were to file a draft of this letter, the filename would be: 011008LtrToTreebeard. By doing this, the computer automatically sorts them "alphabetically" by date.

Good answer, Graybear. I use my own modified version of the ISO date standard to name my 1000s of digital photos and still stay with a classic MSDOS 8.3 character file name for my primative database. The 10th picture I took today on October 14, 2001 will become:

                 ---    format  (jpg for photos)
             ---        picture (001-999, more than enough for a day)
          --            day     (01-31)
         -              month   (1-9, A-C in hex fashion: A is Oct, B is Nov, and C is Dec)
        -               year    (0-9, for 2000-2009)

I'll deal with 2010 when it happens! File naming conventions like this are essential, even if they create future personal Y2K-like problems. The International Standard (ISO 8601) is the right way to go if you are just starting a database with long filenames.

I thought about writing a computer program to find all palindromic dates by testing all possible dates, and then I realized I didn't have to. There are just 366 legal days in a year (including the occasional leap day), and each one translates into one unique palindromic year. Leap days are interesting, but it turns out that leap day palindromes are legal for both mm-dd-yyyy and dd-mm-yyyy schemes according to the rule that (non-century) years are leap years if the last two digits are divisible by four:

mm-dd-yyyy02-29-922020/4=5,   it's legal
dd-mm-yyyy29-02-209292/4=23, it's legal

There are also a few days missing from history. Because of the transition from the Julian to the Gregorian calendar, October 4, 1582 was followed by October 15 1582 in Catholic countries, and September 2, 1752 was followed by September 14, 1752 in Great Britain and the US. But these "missing days" are not potential palindomes.

I did write a small BASIC program to generate all palindromic dates and count the days between successive dates. Both ways of writing dates have 366 palindromic dates in the years between 0001 - 9999, but the distributions are quite different and have interesting patterns. The complete list is available on a separate Web page. Here's part of that list:

CountDatemm-dd-yyyyDays since lastDatedd-mm-yyyyDays since last

77Jul 31, 137007-31-1370 736624 Nov 114224-11-1142 375
78Aug 31, 138008-31-1380 368405 Nov 115005-11-1150 2903
79Oct 02, 200110-02-2001 22683915 Nov 115115-11-1151 375
80Jan 02, 201001-02-2010 301425 Nov 115225-11-1152 376
81Nov 02, 201111-02-2011 66906 Nov 116006-11-1160 2903
82Feb 02, 202002-02-2020 301416 Nov 116116-11-1161 375
83Dec 02, 202112-02-2021 66926 Nov 116226-11-1162 375
84Mar 02, 203003-02-2030 301207 Nov 117007-11-1170 2903
85Apr 02, 204004-02-2040 368417 Nov 117117-11-1171 375
86May 02, 205005-02-2050 368227 Nov 117227-11-1172 376
87Jun 02, 206006-02-2060 368408 Nov 118008-11-1180 2903
88Jul 02, 207007-02-2070 368218 Nov 118118-11-1181 375
89Aug 02, 208008-02-2080 368428 Nov 118228-11-1182 375
90Sep 02, 209009-02-2090 368309 Nov 119009-11-1190 2903
91Oct 12, 210110-12-2101 405719 Nov 119119-11-1191 375
92Jan 12, 211001-12-2110 301429 Nov 119229-11-1192 376
93Nov 12, 211111-12-2111 66910 Feb 200110-02-2001 295182
94Feb 12, 212002-12-2120 301420 Feb 200220-02-2002 375
95Dec 12, 212112-12-2121 66901 Feb 201001-02-2010 2903
96Mar 12, 213003-12-2130 301211 Feb 201111-02-2011 375

I also counted palindromic dates per century. There are nice patterns, and some interesting exceptions that I don't have time to explore now. There were 226,839 days between August 31, 1380 (08-31-1380) and January 2, 2010 (01-02-2010). The largest gaps are 259,698 days (mm-dd-yyyy) and 332,017 (dd-mm-yyyy). Stumpers remain.

Here are some links for further research:

Back to Stumper

Last modified .

Copyright © 2001 by Marc Kummel /