How I wrote “Epoch From Calendar” tool

Tom Smykowski
8 min readFeb 4, 2022

You may be one of people, that like me, have to deal with epoch. For those fortunate to not know what it is, it is a format of representation of time in seconds. People just chose a date in the past, and count seconds to every other date. For example 1643995442 marks 1643995442 seconds since the “start date”.

It is a fancy way of representing date, that has a great advantage: it can be saved in a database column of integer type. However, for people, it is not so great, because it’s hard to imagine birthday based on epoch.

Since I am a programmer, I have to deal with epoch often. Especially since modern data storing solutions available e.g. on cloud are really bad at handling time in more “human design” formats like ISO:

2022-02-04T17:24:07Z

For years I have been using a Epoch Converter: https://www.epochconverter.com/. It is a great tool. However, it is time consuming to put date into it to get epoch. And often that is what you want to do. For example I need to simulate a car that started to drive one hour ago, and will burn all full in one hour to check if the display screen shows correct information. So I have to get epoch for -1h and +1h. Epoch converter does not help a lot here.

Also copying the epoch value is time consuming, because you have to click the field, copy the value, and so on. It seems like a second, but during testing, when you do it hundreds of times, it sums up to be time consuming.

Putting data to get precise epoch is also time expensive and error prone, because you have to put all the data with keyboard.

But it didn’t stop me from using Epochconverter, because it is great and it was enough. However, lately I have decided to write an improved version that will tackle issues described above. Let me present “Epoch From Calendar”:

Epoch From Calendar screenshot

Today I will tell you a little bit about the source code. It may be interesting for you if you are learning to code. Because it is a working project. It is not 100% state of art code, but I had to solve some interesting problems. You can find the source code on GitHub: Epoch From Calendar Source Code

So let us begin:

<!doctype html>
<html>
<head>
<meta charset="utf-8">…
Tom Smykowski

Subscribe To Stay Up To Date With Software Engineering. Business queries: contact@tomasz-smykowski.com