I know that the day is written as a cardinal number (1, 2, 3) and not an ordinal number (1st, 2nd, 3rd) in the day-month-year and the month-day formats. But was there ever a time when ordinal numbers were used instead? I remember writing April 2nd, 2019, etc. and I'm curious what happened.
Dates written with ordinal numbers have always been less common than dates written as cardinal numbers in the month first format. Here is a Google Ngram for the phrases "July 4th" and "July 4":
The curves look slightly different for British versus American English, but the predominance of cardinal dates (when writing the month first) remains the same. I don't know about Canadian, Australian and other varietes of English, as Google Ngram Viewer doesn't allow to select them.
The Ngram for the day first format (i.e. "4 July" and "4th July") shows that in this convention, cardinal numbers have replaced ordinal numbers in the 1940s. Before that, ordinal numbers were the norm:
But this apparent current predominance of cardinal dates (in both month first and day first formats) may be misleading, because the picture changes slightly when you consider where and how dates are written. If you write a date in a common date format, such as "April 26, 2003", current stlye guides recommend that you write cardinal numbers, but they allow that you pronounce these as ordinal numbers. For example, the Chicago Manual of Style recommends:
When specific dates are expressed, cardinal numbers are used, although these may be pronounced as ordinals.
And as soon as you write dates outside of strict date formats, for example when you narrate what happened on the last Independence Day, you will most probably write about the "Fourth of July", not "July 4", so while strictly speaking "fourth" is a word and not a number, it is a word that means a cardinal number. So cardinal numbers are still in use for dates today.
But you ask about the past, and indeed the convention for dates was different a few decades ago. Many of us will remember learning to write "August 2nd" in school (and not "August 2"). For example, the Collins Cobuild English Grammar of 1990 recommends:
Ordinal numbers can be written in abbreviated form, for example in dates or headings or in very informal writing. You write the last two letters of the ordinal after the numbers expressed in figures.
- …on August 2nd
The change from the recommendation of ordinal dates, as in the 1990 Collins Grammar, to a preference of cardinal dates must have taken place before the turn of the millennium, because The Cambridge Grammar of the English Language from 2002 states (p. 1719) that
[i]n recent times the versions … with cardinal numbers have become increasingly favored over those with ordinals.
This seems to contradict the change in the 1940s apparent in the Ngrams of the day first format. But then, grammars and style guides are always a bit behind actual usage, so that the 1990 Collins Grammar was merely continuing to recommend a tradition that unnoticed by its authors had already fallen out of use.
I would like to note that contrary to what @Chenmunka claims in their comment, British English doesn't universally follow the day before month convention. As the Wikipedia article on Date and time notation in the United Kingdom states:
The month-first form (for example "December the third") was widespread until the mid twentieth-century, and remains the most common format for newspapers across the United Kingdom.
A screenshot from the Times website provides proof:
Many people in Britain still write dates as ordinal numbers. I share a classroom with another teacher who absolutely insists on students writing them as ordinal numbers.