August 1970


Why has everyone been hired in August 1970?

Some days ago a colleague and I were looking at some weird data about our profiles in one system (an instance of the open-source Moodle platform). It seemed like every one of us had been hired in August of year 1970, with only slight changes in the exact day.

I mean, were it the same day for all of us I might have thought of some error like a hardcoded value, but the day actually changed so it was somehow related to the actual date.

Let’s take, as an example, someone being hired on May 4th, 2022. Well, our weird system would think that they would have been hired on August 23rd, 1970 instead.

What gives? Well, the first thing to take into consideration is how we fed the hiring date to the system, which is in YYYYmmdd format, like 20220504 in our example. Which is interestingly close to be read as an integer decimal number amounting to slightly above 20 millions.

The other clue is that it’s all happening in year 1970, which is a notable year by itself, at least for IT people.

I’m not good at suspance, and most of you will have guessed right at this point: the system thinks that these values are unix times expressed as seconds since 1970-01-01 00:00:00. Let’s look at some examples:

$ perl -MPOSIX=strftime -E 'say strftime "%Y-%m-%d", gmtime $_ for @ARGV' \
    19000101 19700101 19900101 20100101 20220504

Now this makes sense!

Stay safe folks!

Comments? Octodon, , GitHub, Reddit, or drop me a line!