AppDevTools
AppDevTools
/
Converters
UNIX Timestamp Converter

UNIX Timestamp Converter

client
Friday, 26 April 2024, 17:20:44 (UTC)
Friday, 26 April 2024, 17:20:44 (Local)

Documentation

What is a UNIX timestamp?

UNIX timestamp is a time system for describing a moment in time in second also known as Epoch timestamp and POSIX timestamp. The UNIX timestamp is the number of seconds that have been counted since the start of January 1, 1970 (UTC) without leap seconds.

Therefore, 1 day in the UNIX timestamp is treated equally as if it has 86,400 seconds which is different from UTC that always includes leap seconds.

The UNIX timestamp is counted simultaneously throughout the world regardless of timezones which means a UNIX timestamp represents the certain moment in second at any place of the world. Therefore, a UNIX timestamp can be converted to any timezone as a result.

The example UNIX timestamp below represents the time 07:52:04 (UTC) on August 17, 2004 while it's also 03:52:04 (America/New York) on August 17, 2004 at the same moment.

1092729124

How to get the current UNIX timestamp

You can easily get the current UNIX timestamp on Linux and macOS just by typing the following command in the terminal. The result based on your system clock will be displayed accordingly.

date +%s
1574913970

In computer programming, there exists the built-in method for getting the current UNIX timestamp in most programming languages so that developers can handle time-related functions with ease.

For instance, the following is how to get the current UNIX timestamp in JavaScript.

const currentTimestamp = Math.floor(Date.now() / 1000); // Get the current UNIX timestamp in milliseconds using the built-in method Date.now(), and then convert it to seconds by dividing it with 1000.

Moreover, you can use Moment.js, one of the most used libraries for manipulating time in JavaScript, to get the current UNIX timestamp in seconds. The result will be an integer representing the current UNIX timestamp based on your system clock.

moment().unix(); // 1574914824

Related Tools

JavaScript / JSON Converter

Converts between JavaScript objects and JSON data instantly with your preferred indentation level.

CSV / JSON Converter

Converts between CSV and JSON data with highly customizable options.

JSON / XML Converter

Converts between JSON and XML data with your preferred indentation level.

JSON / PHP Array Converter

Converts between JSON data and PHP arrays instantly with your preferred indentation level and quote type.

Text / HEX Converter

Converts between text and HEX and gets the result instantly. Supports Unicode characters.

Base Converter

Freely converts base numbers between binary, octal, decimal, and hexadecimal and gets the result instantly, such as BIN to DEC, OCT to BIN, DEC to HEX, HEX to BIN, and so on.

Unit Converter

Converts a value from a unit to another and gets the result instantly, such as length, area, mass, volume, temperature, time, digital, speed, and more.

Share