Timestamp Converter

Runs in browser

Convert, compare, and calculate timestamps

Quick Presets
Add/Subtract Time

How to Use

Convert timestamps and date strings.

  • Enter Unix Timestamp (e.g. 1700000000)
  • Or enter Date String (e.g. 2024-01-01)
  • View formats, local time, and timezone info
Output Formats

Enter a timestamp or date

Or click the live clock to use current time

About Unix Timestamps

A Unix timestamp (also called epoch time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. This date is known as the Unix epoch and serves as the reference point for time calculations in Unix-like systems and many programming languages.

Key Concepts

Epoch

The starting point (January 1, 1970, 00:00:00 UTC) from which Unix time is measured. This date was chosen as it represents the beginning of the Unix operating system era.

Timezone Independent

Timestamps are always in UTC (Coordinated Universal Time), making them portable across systems and timezones. This eliminates timezone ambiguity in data storage and transmission.

Seconds vs Milliseconds

Some systems use seconds (Unix standard), while others use milliseconds (JavaScript, many APIs). Always verify which format your system expects: milliseconds = seconds × 1000.

Why Use Unix Timestamps?

  • Simplicity: A single integer represents a precise moment in time, making it easy to store and transmit
  • Sorting: Timestamps can be easily sorted numerically, which is perfect for chronological data
  • Calculations: Time differences are simple subtraction operations (e.g., timestamp2 - timestamp1)
  • Storage: Integers are compact and efficient to store in databases and files
  • Universality: No timezone ambiguity—always UTC, making data portable across systems
  • Precision: Can represent time down to the second (or millisecond) level

Common Timestamp Formats

Unix Timestamp (Seconds)

The classic format: seconds since epoch. Used by Unix systems, Python, and many databases.

1701388800

Unix Timestamp (Milliseconds)

Used by JavaScript, Java, and many modern APIs. Multiply seconds by 1000 to convert.

1701388800000

ISO 8601

Human-readable standard format used in JSON APIs and web applications.

2023-12-01T00:00:00.000Z

RFC 2822

Email date format, commonly used in email headers and some APIs.

Fri, 01 Dec 2023 00:00:00 GMT

The Year 2038 Problem

32-bit systems store timestamps as a signed 32-bit integer, which can only represent dates up to January 19, 2038 (timestamp 2147483647). After this date, the value overflows and wraps around to negative numbers, causing incorrect date calculations.

Modern 64-bit systems use 64-bit integers, which can represent dates for billions of years into the future, effectively solving this problem.

Working with Timestamps in Code

JavaScript

// Current timestamp (milliseconds)
Date.now()

// Convert to Date
new Date(1701388800 * 1000)

// Get timestamp from Date (seconds)
Math.floor(new Date().getTime() / 1000)

Python

import time
from datetime import datetime

# Current timestamp
time.time()

# Convert to datetime
datetime.fromtimestamp(1701388800)

# Get timestamp from datetime
datetime.now().timestamp()

Go

import "time"

// Current timestamp
time.Now().Unix()

// Convert to Time
time.Unix(1701388800, 0)

// Get timestamp from Time
t.Unix()

Common Pitfalls

  • Seconds vs Milliseconds: Always check which format an API expects. JavaScript uses milliseconds, while Unix systems use seconds.
  • Timezone Confusion: Display times in the user's timezone, but always store timestamps in UTC in your database.
  • Leap Seconds: Unix time doesn't account for leap seconds, which can cause minor discrepancies in very precise time calculations.
  • Date Boundaries: Be careful when converting between timezones, as dates can shift (e.g., 11 PM UTC might be the next day in another timezone).

💡 Pro Tips

  • Always store timestamps in UTC in databases, then convert to user's timezone for display
  • Use ISO 8601 format for APIs and JSON data as it's human-readable and unambiguous
  • When working with JavaScript, remember that Date.now() returns milliseconds, not seconds
  • For precise time calculations, consider using libraries like moment.js or date-fns that handle edge cases
  • When comparing timestamps, ensure both are in the same format (seconds or milliseconds)

Further Reading