logo
GeekFormat

Unix Timestamp Converter

Current Unix Timestamp
1784571457
2026-07-21 02:17:37 (UTC)

Code Examples

JavaScript
// Current timestamp new Date(Convert timestamp to date).toLocaleString()
Python
import time time.time() # Current timestamp time.ctime(1800000000) # Convert timestamp to date
Go
import "time" time.Now().Unix() // Current timestamp time.Unix(1800000000, 0).String()
Bash
# Current timestamp date +%s # Convert timestamp to date date -d @1800000000

Unix timestamp (also known as POSIX time or epoch) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970, not counting leap seconds. Most Unix systems store timestamps as 32-bit signed integers, which will overflow on January 19, 2038.

Free online Unix timestamp converter with seconds/milliseconds/microseconds bidirectional conversion, automatic unit detection, UTC/Local timezone toggle, and built-in multi-language code examples. Ready to use instantly for development and debugging.

Related

What is a Unix Timestamp?

A Unix Timestamp (also called Epoch Time or POSIX Time) is a way to represent time as a single number: the count of seconds elapsed since January 1, 1970, 00:00:00 UTC (the Unix Epoch), not counting leap seconds. At the Unix Epoch itself, the timestamp is 0.

The biggest advantage of timestamps is timezone independence—the same moment produces the same timestamp anywhere on Earth, with no timezone conversion issues. This makes them ideal for: database record creation/update times, distributed system log tracing (trace/span IDs with timestamps), API time parameters, JWT token expiration times, cache TTL values, and filesystem modification times.

Different languages and systems use different precisions: C/Unix/Python default to seconds (10 digits), JavaScript/Java use milliseconds (13 digits), and high-precision systems (financial trading, scientific computing) use microseconds (16 digits) or even nanoseconds (19 digits). This tool covers the three most common precisions: seconds, milliseconds, and microseconds.

Use Cases

  • Convert timestamps in log files to readable dates during development debugging to quickly locate issue timestamps
  • Verify timestamp fields in request/response payloads during API integration
  • Convert business times to timestamps for SQL time-range queries in database operations
  • Compare UTC timestamps with local time during server operations to troubleshoot cross-timezone deployments
  • Copy code snippets for getting timestamps in various languages when writing scripts
  • Convert historical (pre-1970) or future dates to timestamps for testing edge cases

How to Use

  1. The top of the page shows a live ticking current Unix timestamp that can be copied directly with one click
  2. To convert timestamp to date: Enter the timestamp in the 'Timestamp → Date' tab—the tool auto-detects seconds/milliseconds/microseconds
  3. Select UTC or Local timezone; the result appears instantly and can be copied with the copy button
  4. To convert date to timestamp: Switch to the 'Date → Timestamp' tab and fill in year/month/day/hour/minute/second fields
  5. After selecting timezone, the seconds timestamp appears instantly—one-click copy for code or queries

Features

  • Auto-detect units: Paste any timestamp and it automatically identifies seconds/milliseconds/microseconds—no manual selection needed
  • Three precision levels: Full coverage of seconds (10-digit), milliseconds (13-digit), and microseconds (16-digit) for all languages and systems
  • UTC/Local timezone toggle: UTC for server logs, Local for business time—one-click switch for comparison
  • Field-by-field date input: Separate year/month/day/hour/minute/second input boxes for date-to-timestamp conversion—no date format to memorize
  • Live timestamp display: Real-time ticking current Unix timestamp with UTC date shown at the top, one-click copy
  • Multi-language code snippets: Built-in JavaScript/Python/Go/Bash code for getting and converting timestamps, one-click copy
  • Negative timestamp support: Convert any date from 1920 to 2100, covering historical and future dates
  • Client-side calculation: All conversions run locally in your browser—timestamps never sent to any server

Code Examples

Get and Convert Timestamps in JavaScript

javascript

Common methods for getting current seconds/milliseconds timestamps in browsers and Node.js, and converting them to readable local time.

// Get current seconds timestamp
const tsSec = Math.floor(Date.now() / 1000);
console.log(tsSec); // e.g. 1700000000

// Get current milliseconds timestamp
const tsMs = Date.now();
console.log(tsMs); // e.g. 1700000000000

// Seconds timestamp to local readable time
const date = new Date(tsSec * 1000);
console.log(date.toLocaleString('en-US'));
// "11/14/2023, 10:13:20 PM"

// Milliseconds timestamp to ISO format
console.log(new Date(tsMs).toISOString());
// "2023-11-14T22:13:20.000Z"

Timestamp Handling in Python

python

Using Python's standard library time and datetime modules to get and convert timestamps, including timezone handling.

import time
from datetime import datetime, timezone

# Get current seconds timestamp
ts = int(time.time())
print(ts)  # 1700000000

# Timestamp to local time string
print(time.ctime(ts))
# 'Tue Nov 14 14:13:20 2023'

# Timestamp to formatted time
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(ts)))
# '2023-11-14 14:13:20'

# Timestamp to UTC time
print(datetime.fromtimestamp(ts, tz=timezone.utc))
# 2023-11-14 22:13:20+00:00

Linux/macOS Command Line Timestamp Operations

bash

Common shell commands for getting current timestamps and converting them, noting differences between Linux GNU date and macOS BSD date.

# Get current seconds timestamp (works on both Linux and macOS)
date +%s

# Timestamp to date (Linux GNU date)
date -d @1700000000
# "Tue Nov 14 22:13:20 UTC 2023"

# Timestamp to date (macOS BSD date)
date -r 1700000000

# Timestamp to UTC date (Linux)
date -u -d @1700000000
# "Tue Nov 14 22:13:20 UTC 2023"

# Custom format output
date -d @1700000000 '+%Y-%m-%d %H:%M:%S'

FAQ

What is a Unix Timestamp?

A Unix Timestamp (also called Epoch Time or POSIX Time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC (Coordinated Universal Time), not counting leap seconds. For example, 1700000000 corresponds to 2023-11-14 22:13:20 UTC. It is timezone-independent—the same timestamp represents the same moment everywhere on Earth—making it the standard for cross-system time recording, log tracing, API parameters, and database storage.

How to distinguish seconds, milliseconds, and microseconds timestamps?

By digit count: 10 digits = seconds (e.g., 1700000000), 13 digits = milliseconds (e.g., 1700000000000), 16 digits = microseconds (e.g., 1700000000000000). This tool automatically detects the unit based on the number of digits you paste—no manual selection needed. It also trims whitespace automatically, so you can paste directly from logs.

Why is the timestamp in logs 8 hours off from local time?

Unix timestamps are inherently UTC-based. If your local timezone is UTC+8 (e.g., China Standard Time), converting a UTC timestamp using local timezone rules will show an 8-hour difference. This tool provides a UTC/Local timezone toggle—use UTC when reading server logs (most servers use UTC), and Local time for business-facing timestamps.

How to get and convert timestamps in JavaScript?

Get current seconds timestamp with `Math.floor(Date.now() / 1000)`, milliseconds with `Date.now()`; convert to readable time with `new Date(ts * 1000).toLocaleString()` (multiply seconds by 1000, pass milliseconds directly). Built-in code snippets for JavaScript, Python, Go, and Bash are provided at the bottom of the page for direct copy.

Can timestamps be negative? What do they represent?

Yes. Negative timestamps represent dates before January 1, 1970. For example, -1 corresponds to 1969-12-31 23:59:59 UTC. This tool supports negative timestamps and covers dates from 1920 to 2100, supporting both historical dates and future dates.

What is the Year 2038 problem? Will it affect usage?

The Year 2038 Problem occurs when systems using 32-bit signed integers to store Unix timestamps overflow after January 19, 2038, 03:14:07 UTC, causing dates to wrap to negative values. Modern systems use 64-bit integers (safe for ~292 billion years), and JavaScript uses 64-bit floats (safe to year 285,616 at millisecond precision). Since this tool runs in your browser using JavaScript, it is not affected.

Why use an online converter instead of the command line?

Command-line tools (like Linux's `date`) require memorizing format flags, and parameters differ across platforms (Linux GNU date vs macOS BSD date have different flags). This tool works instantly in your browser, auto-detects units, provides visual date input fields (separate year/month/day/hour/minute/second fields—no date format memorization), timezone toggling, and built-in multi-language code snippets.

Glossary

Unix Timestamp
Seconds elapsed since 1970-01-01 00:00:00 UTC, 10 digits, timezone-independent, globally consistent.
Epoch Time
Alternative name for Unix Timestamp, referring to time counted from the Unix Epoch (1970-01-01 UTC).
Seconds Timestamp
10-digit precision to the second (e.g., 1700000000), default in Unix/Python/C.
Milliseconds Timestamp
13-digit precision to 1/1000 second (e.g., 1700000000000), default in JavaScript/Java.
Microseconds Timestamp
16-digit precision to 1/1,000,000 second (e.g., 1700000000000000), used in high-precision systems.
UTC
Coordinated Universal Time, the global time standard and baseline for timezone calculations, roughly equivalent to GMT.
Timezone Offset
Difference between local time and UTC, e.g., US Eastern is UTC-5 (standard time), China Standard Time is UTC+8.
ISO 8601
International standard date/time format (e.g., 2024-01-15T08:30:00+08:00), the standard for API parameters.
Year 2038 Problem
Overflow of 32-bit signed integer timestamps after Jan 19, 2038; 64-bit systems and JavaScript are not affected.

Common Time Unit Conversions

Time UnitSecondsExample Use
1 minute60Short cache TTL, API timeouts
1 hour3,600Short-lived tokens, session timeouts
1 day86,400Daily stats, daily reports
1 week604,800Weekly reports, cookie expiration
1 month (30.44 days)2,629,743Monthly billing, subscription cycles
1 year (365.24 days)31,556,926Annual data, long-lived JWT tokens

Timestamp Operations by Programming Language

LanguageGet Current (seconds)Timestamp to Readable
JavaScriptMath.floor(Date.now()/1000)new Date(ts*1000).toLocaleString()
Pythonimport time; int(time.time())import time; time.ctime(ts)
JavaSystem.currentTimeMillis()/1000new Date(ts*1000L).toString()
Gotime.Now().Unix()time.Unix(ts, 0).String()
PHPtime()date('Y-m-d H:i:s', ts)
MySQLSELECT UNIX_TIMESTAMP()SELECT FROM_UNIXTIME(ts)
Bash (Linux)date +%sdate -d @ts
Bash (macOS)date +%sdate -r ts

Authoritative References