I was originally thinking to count down the days. Eh, changes too slowly, too boring. Hours, Minutes? Better. Nay, let’s go for seconds! It’s going to be lots of seconds. Seconds from when? Well, seconds from the current date to the MER date. If the MER date changes, things could get complicated. So, I picked a point in time and called that time zero. That point is the beginning of 2020. Yeah, I know 2020 wasn’t a great year, but I wanted a multiple of 4 (for leap year calculations) and it had to be before now and before the MER date. So, the first second of 2020 it is! Well, I guess it would be the 0th second? Whatever. So the time to retirement (to be displayed) will be the MER date (in seconds from 2020) minus the current date (in seconds from 2020). Seems pretty simple. Ha!

Need to calculate the number of seconds from the beginning of 2020 to the MER date. This will be a constant.

Let’s use a MER date of August 31, 2024*.

First, calculate the number of seconds in the full years:

2020: 31,622,400 secs (leap) +

2021: 31,536,000 +

2022: 31,536,000 +

2023: 31,536,000 = 126,230,400 secs

And for the partial year 2024:

January through August, except for the last day in August because that is a partial day.

(31 + 29 + 31 + 30 + 31 + 30 + 31 + 30) = 243 full days * 86,400 = 20,995,200 + 126,230,400 = 147,225,600 secs.

Aug 31 at 5 PM, +17 hours * 3600 = 61,200 seconds.

Add all that up and we get 147,286,800 seconds total from beginning of 2020 to the MER date. This is going to have to be a long integer.

This was fairly easy to calculate one-time with a fixed date. It gets more complicated when calculating the current seconds from 2020 because of leap years and different number of days in different months.

Do I really need to be this accurate? No, not really. But I want to. And, I am not adjusting for daylight saving time (DST). MERC just stays with PST. So, it can be 3600 seconds off. But an accurate 3600 seconds! Good enough for retirement-planning purposes.

*This date may or may not have been changed to protect Martha’s privacy.

Leave a Reply