edcilo

Epoch

Unix epoch is a term used to refer to a time measurement system used in Unix operating systems and other related systems. The term "epoch" refers to a specific moment in time from which time is measured in seconds. This moment is January 1, 1970 at 00:00:00 UTC.
The use of Unix epoch as a time measurement system is due to its simplicity and ease of implementation. Time is measured in seconds from the start of the epoch, which allows for easy calculation of time intervals. Additionally, Unix epoch is a universal time system that can be used worldwide, as it is based on Coordinated Universal Time (UTC).
Unix epoch is used by many computer systems and applications, including databases, web servers, version control systems, and file systems. It is also used by some programming languages such as C, Java, and Python, among others.
However, Unix epoch has some limitations. Time measurement is done in seconds, which can be imprecise in some cases, especially when dealing with very small time intervals. Additionally, Unix epoch does not take into account the variation in day length due to factors such as the rotation of the Earth.
Despite its limitations, Unix epoch remains a widely used and valued time measurement system in the world of computing and programming. Its simplicity and universality make it a valuable tool in many fields and a fundamental part of the history and evolution of operating systems and programming.
Wikipedia

Epoch in Python

import time
epochTime = int(time.time())

Epoch in Go

const epochTime = time.Now().Unix()

Epoch in JavaScript

const epochTime = Date.now()

Epoch in Bash

epochTime=$(date +%s)

Epoch in MySQL

SELECT unix_timestamp(now())

Epoch in PostgreSQL

SELECT extract(epoch FROM now());