Timestamp Converter

Convert between Unix timestamps and human-readable dates.

Input

Enter a Unix timestamp or ISO date string

About This Tool

Unix timestamps represent time as a single number (seconds or milliseconds since January 1, 1970). This tool converts between timestamps and readable date/time formats.

What is a Unix Timestamp?

A Unix timestamp is a way to represent time as a single number. It counts the number of seconds (or milliseconds) that have elapsed since January 1, 1970, at 00:00:00 UTC. This date is known as the "Unix epoch" and serves as the reference point for all Unix timestamps.

Unix timestamps are widely used in programming because they're simple, compact, and easy to work with programmatically. They're language-agnostic and don't suffer from timezone or localization issues that plague human-readable date formats.

How to Use This Timestamp Converter

Converting Timestamps to Dates:

  1. Enter a Unix timestamp (like 1704067200) in the input field
  2. Check "Milliseconds" if your timestamp is in milliseconds
  3. Click "Convert" to see the human-readable date
  4. Get results in your local timezone and UTC

Converting Dates to Timestamps:

  1. Enter a date string (like "2024-01-01" or "2024-01-01T12:00:00Z")
  2. Check "Milliseconds" if you want millisecond precision
  3. Click "Convert" to get the Unix timestamp
  4. Use the timestamp in your applications or APIs

Getting Current Time:

  1. Click "Current Time" to populate the input with the current timestamp
  2. Convert it to see the current date and time
  3. Perfect for testing and development

Common Use Cases

  • API Development: Convert between timestamps and readable dates for API requests and responses
  • Database Storage: Store dates as timestamps for efficient querying and sorting
  • JWT Tokens: Check expiration times (exp claims) in JWT tokens
  • Logging: Use timestamps for consistent, sortable log entries across timezones
  • Data Analysis: Convert timestamps for data visualization and reporting

Timestamp Formats

Seconds (Standard)

Most common format, counts seconds since Unix epoch. Example: 1704067200 (January 1, 2024)

Milliseconds

Higher precision, counts milliseconds since Unix epoch. Example: 1704067200000

ISO 8601

Human-readable format: 2024-01-01T00:00:00.000Z (with timezone information)

Frequently Asked Questions

Q: Why do timestamps start from 1970?

January 1, 1970, is the date when Unix was first released. This date was chosen as the epoch because it was a recent date at the time and avoided issues with different calendar systems.

Q: Are timestamps affected by leap seconds?

Unix timestamps don't account for leap seconds. They count SI seconds continuously. This can cause small discrepancies with UTC time, but it's rarely a practical concern.

Q: What's the difference between local time and UTC?

UTC is Coordinated Universal Time, the primary time standard. Local time is UTC adjusted for your timezone offset. Timestamps are always stored as UTC to avoid timezone confusion.

Q: Can timestamps represent dates before 1970?

Yes, negative timestamps represent dates before 1970. For example, -1 represents December 31, 1969, at 11:59:59 PM UTC.

Programming Language Examples

JavaScript

// Get current timestamp
const now = Date.now(); // milliseconds
const nowSeconds = Math.floor(Date.now() / 1000); // seconds

// Convert timestamp to date
const date = new Date(timestamp * 1000);

// Convert date to timestamp
const timestamp = Math.floor(date.getTime() / 1000);

Python

import time
import datetime

# Get current timestamp
now = time.time()  # seconds with decimals

# Convert timestamp to date
date = datetime.datetime.fromtimestamp(timestamp)

# Convert date to timestamp
timestamp = date.timestamp()

Related Tools