HeoLab
ToolsBlogAboutContact
HeoLab

Free developer tools with AI enhancement. Built for developers who ship.

Tools

  • JSON Formatter
  • JWT Decoder
  • Base64 Encoder
  • Timestamp Converter
  • Regex Tester
  • All Tools →

Resources

  • Blog
  • What is JSON?
  • JWT Deep Dive
  • Base64 Explained

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 HeoLab. All rights reserved.

Tools work in your browser. Zero data retention.

HomeBlogUnix Timestamps: A Complete Developer's Guide
Table of Contents▾
  • Table of Contents
  • What is a Unix Timestamp?
  • The Epoch Explained
  • Milliseconds vs Seconds
  • Year 2038 Problem
  • Language Examples
guides#timestamp#unix#datetime

Unix Timestamps: A Complete Developer's Guide

Everything you need to know about Unix timestamps — what they are, how to work with them in any language, and common pitfalls.

Trong Ngo
February 22, 2026
2 min read

Table of Contents

  • What is a Unix Timestamp?
  • The Epoch Explained
  • Milliseconds vs Seconds
  • Year 2038 Problem
  • Language Examples

What is a Unix Timestamp?

A Unix timestamp is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — known as the Unix epoch.

// Current timestamp (seconds)
const now = Math.floor(Date.now() / 1000);

// Convert timestamp to Date
const date = new Date(1708560000 * 1000);
console.log(date.toISOString()); // '2024-02-22T00:00:00.000Z'

The Epoch Explained

Why 1970? When Unix was developed, its creators picked January 1, 1970 as an arbitrary but convenient starting point. Unix time counts seconds elapsed, making date arithmetic trivially simple:

const ONE_DAY = 60 * 60 * 24; // 86400 seconds
const thirtyDaysAgo = Math.floor(Date.now() / 1000) - 30 * ONE_DAY;

Milliseconds vs Seconds

SystemUnitExample
UnixSeconds1708560000 (10 digits)
JavaScriptMilliseconds1708560000000 (13 digits)
PythonSecondstime.time()
JavaMillisecondsSystem.currentTimeMillis()

Quick check: 13 digits = milliseconds, 10 digits = seconds.

Year 2038 Problem

32-bit systems store Unix timestamps as a signed 32-bit integer, which overflows at 2,147,483,647 — January 19, 2038. Modern 64-bit systems won't have this problem for ~292 billion years.

Language Examples

import time
now = int(time.time())  # seconds
now := time.Now().Unix()  // seconds
use std::time::{SystemTime, UNIX_EPOCH};
let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();

Use the Timestamp Converter to convert any Unix timestamp to a human-readable date.

Try These Tools

Unix Timestamp Converter

Convert Unix timestamps to human-readable dates and vice versa. Supports all major timezone formats.

Related Articles

JavaScript Date API Cheatsheet for Developers

2 min read

Date and Time Best Practices for APIs

1 min read

ISO 8601 Date Format: The Standard Every Developer Should Know

1 min read

Back to Blog

Table of Contents

  • Table of Contents
  • What is a Unix Timestamp?
  • The Epoch Explained
  • Milliseconds vs Seconds
  • Year 2038 Problem
  • Language Examples

Related Articles

JavaScript Date API Cheatsheet for Developers

2 min read

Date and Time Best Practices for APIs

1 min read

ISO 8601 Date Format: The Standard Every Developer Should Know

1 min read