How many days have there been? Ever?
It might seem trivial at first, but the problem becomes somewhat more complex when the evolving dynamic of the rotation of the Earth is considered. At the time of writing this, detailed measurements of the speed of the Earth's rotation simply don't exist for most of it's history. However, the data that is available, mainly consisting of estimates based on stromatolite layers and tidal rhythmites, demonstrates two key points:
(1) The length of day has increased at a somewhat consistant rate for the past 600 million years, from around 21 hours then to 24 today, and
(2) the rate of change was much slower for a large portion of the Precambrian.
So why has the Earth's rotation slowed down, and why has it recently[1]A relative term if there's ever been one. been slowing down more than before? The dynamics of the deceleration of the Earth is really nothing like a spinning top slowed down by air resistance, first and foremost because there isn't exactly any air in space. The primary factor that influences changes in the rotation is tidal friction caused by the orbit of the Moon, which in effect transfers angular momentum from the Earth to the Moon, so to understand what all forces are at play, it's necessary to look at the Earth and Moon as a single rotational system.
If it's assumed that all of the angular momentum currently present in the Earth-Moon system has been present since the Moon's formation 4.52 billion years ago, it can be calculated through Kepler's laws and the preservation of angular momentum that the Earth would have completed a full rotation approximately every 5 hours with the Moon coagulating just beyond the Roche limit. At this point, the Moon would be at least 15,000 km from the Earth. Were it any closer, it would be completing an entire orbit in less than 5 hours, faster than the Earth's spin, meaning instead of slowing the rotation, it would accelerate it, and the Moon would fall back to Earth. Instead, the Earth has transferred its angular momentum to the Moon, pushing it to a higher orbit.[2]Confusingly, adding momentum to an orbiting body causes it to orbit slower. As for the speed of rotation before the Moon's formation, it would be essentially impossible to determine, as whatever collision caused the formation would have drastically disrupted the dynamics of it.
For the future evolution of the system, I found a simulation from a paper[3]https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2016GL068912 by Benjamin C. Bartlett and David J. Stevenson which factors in not only oceanic tidal friction, but also a critically important effect of the Earth's atmospheric thermal tide. The effect was theorized in a 1987 paper[4]https://www.sciencedirect.com/science/article/pii/0301926887900738 by Kevin Zahnle and James Walker as an explanation for point (2) mentioned earlier. What Zahnle and Walker proposed is that during the Precambrian, once the Earth has slowed to a rotation period of around 21 hours, the "semidiurnal atmospheric thermal tide would have been resonant with free oscillations of the atmosphere", and the solar torque on the atmosphere would have an accelerating effect on the Earth's rotation that would cancel out the decelerating force of the lunar tide. As a result, the length of a day may have remained stable, within a few minutes of 21 hours, for a significant portion of Earth's history.
So, if 21 hours is the magic number to stabilize the Earth's rotation, why has the length of a day increased so significantly to 24 hours in the last 600 million years?
If the theory proposed in the papers is correct, the disruption was quite likely caused by the period of Snowball Earth. The planet has endured several prolonged ice ages[5]Ice ages themselves have periods of colder periods, called glacials, and warmer periods, called interglacials. The Ice Age known for its woolly mammoths and land bridges was simply the most recent glacial of the Quaternary glaciation, as the Earth is technically in an interglacial of an ice age that's lasted the past 2.58 million years. The planet would return to much colder temperatures when the next glacial comes some 50000 years from now, but it's likely that climate change will prevent that. throughout it's history, but in the time before the Cambrian explosion, there were a few so severe that it's theorized that glaciers reached as far as the equator, giving the planet the appearance of a snowball. Though most of these are projected to have occured before the Earth's rotation reached resonance, the Cryogenian Period, lasting from 720 to 635 million years ago, could have released the rotation from its stable equilibrium due to how the extreme changes in temperature affect the atmospheric tides.
Using the simulation, I compiled a spreadsheet of the lengths of the Earth's rotation and the Moon's orbit from the formation of the Moon 4.52 billion years ago to 50 billion years in the future, by which point the Earth will have long since been tidally locked with the Moon and further changes are unpredictable.
Below are the results:
Bend in month length caused by a minor change in the formula used for past and future.
In total, from the formation of the Moon until now, there have been 2.4 trillion days.
Based on the projected slowing of Earth into the future, by the time the Earth is tidally locked with the Moon 26 billion years from now, there will have been 4.6 trillion days, meaning it's likely that nearly half of all the days that will ever happen on Earth have already passed.
The data also shows that there have been approximately 100 billion months, taking "month" to mean a single orbit of the Moon.
Because the Earth's orbit around the Sun has not changed much since the Solar System formed, it can then be calculated that the average year on Earth so far has had 530 days.
Below are charts of the cumulative counts of days and months:
I have also created an animation of the Earth's rotation: