Correcting Epoch time strangeness | Miklas Njor

Correcting Epoch time strangeness

Epoch time that is way off

I was accessing data from an API and made an Exploratory Data Analysis (EDA). One irregularity that I noticed, was that the epoch time was off by roughly forty-six thousand years! How the epoch time came to be so long, could stem from the decimal “dot” had somehow been removed.

A hack work-around was to convert the epoch time to a string variable, chop off the last three digits, insert a decimal dot, and glue the string back together as an float. This way I was able to get the correct value. As far as I can see, this way of doing it, is safe for values up to the year 9999, possibly more.

Leave a Reply

Your email address will not be published. Required fields are marked *