What Is Linux Epoch Time? – POFTUT

What Is Linux Epoch Time?

Epoch time is used in Linux systems regularly to express a given date and time. Epoch time may be very strange for Non-Linux users. But epoch time uses very simple logic to calculate date and time.

Start Of Date and Time

Epoch time uses reference point to calculate date and time. Reference point for epoch time is 01.01.1970 or the first day of the year 1970 . The reference time is also 00:00:00 which is the start time of the year.

Epoch Time

Epoch time is expressed as the total seconds count from start of the 1970 which is stated in detail in previous part. For example if we want to get epoch time of 01 Jabuary 2017 with time 00:00:00 we will get 1483218000

Epoch Time In Milliseconds

Epoch time is generated in seconds by default. But if we need more precise epoch time we can use miliseconds in order to express a given date and time. This is the same with second based time calculation. But values will be bigger like 1<span id="epochMs" class="timestamp">524277982208

Convert Epoch Time In Bash Shell

One of the most popular use cases for epoch time is using with Linux bash shell. We can use date command in order to print the current date in epoch format.

$ date +%s

Convert Epoch Time In Python Shell

Python is another popular and powerful shell that can be used to create the current date and time in epoch format. We will use the time module in order to use time() function. In this example, we will convert the current time in epoch format with python.

import time

LEARN MORE  How To Navigate, List Files and Directories In Windows Command Line With Dir?

2 thoughts on “What Is Linux Epoch Time?”

  1. Don’t see any conversions to H format. It appears each example converts the other way – to epoch. Perhaps I’m missing something or not understanding the title of the article.. Regards


Leave a Comment