Skip to content
Advertisement

How to convert timestamp from Hexadecimal format to EPOCH timestamp?

I am looking for a Linux command to convert hexadecimal time format to Linux timestamp. I have tried this command:

JavaScript

But it seems to be wrong, the epoch output of 0xd6979880 should be 1391270400. Please correct me if I am wrong.

Advertisement

Answer

From your description (expecting 1391270400 instead of 3600259200), at appears that your hex dates are seconds since 1900-01-01 rather than POSIX timestamps (seconds since 1970-01-01). Fortunately, it’s very easy to correct this offset, just by subtracting 70 years:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement