UNIX format timestamps have an extensive range of use. You will find out the main reasons that back up this claim, but for now, letís say that it is because working with dates and times in the UNIX time format is easier and more resource efficient. In this article, our goal is to demystify the concept, learn the theory that lies behind it, and ultimately write algorithms and implementations that convert dates back and forth from the traditional ISO standard to UNIX format.
UNIX time, which is sometimes referred to as POSIXtime, is a relatively ďsimpleĒ format that represents time using its very own system. Iíve opted for the quotations around simple because, despite how itís going to look at first glance, by the time you finish reading this article, I am sure that youíre going to find them quite simple and effective.
1577909730 -> 2020-01-01T20:15:30+00:00 -> Wed, 01 Jan 2020 20:15:30 +0000
In the above example, the first column is the time specified in UNIX time format, the second is in the widely popular ISO 8601 standard, and the latter is in RFC 2822 format, which is also called Internet Message Format. For a detailed guide and information regarding the RFC 2822, Iíd suggest checking out this document. It is the official abstract related to the standard and its outlines.
Now that youíve seen some examples of UNIX time, those strings of digits must seem a bit odd, right? Itís weird when somebody suggests that they represent valid dates and times. On the next page, weíre going to explain the theory and the mathematics behind it.