CURRENT EPOCH · EPOCHTIME.TOOLS · A PRECISION INSTRUMENT FOR TIME
Converter Batch Difference Blog
Languages
JavaScript Python TypeScript Go Rust Java PHP SQL Bash
Specialty
LDAP Timestamp .NET Ticks Chrome/WebKit Cocoa / Core Data Discord Timestamp Excel OADate Unix Hex
Standards
ISO 8601 Guide Year 2038 NTP Timestamp GPS Time Julian Day

Get current Unix timestamp

JavaScript's `Date.now()` returns milliseconds since the epoch. For seconds, divide and floor.

Seconds (10 digits)

Math.floor(Date.now() / 1000)
// → 1735689600

Milliseconds (13 digits)

Date.now()
// → 1735689600000

Microseconds

// JavaScript doesn't have native μs. Use performance.now() for relative timing
// or multiply ms × 1000 for an approximation.
Date.now() * 1000

Convert epoch to Date

The `Date` constructor accepts milliseconds. If you have seconds, multiply by 1000 first.

Seconds → Date

const date = new Date(1735689600 * 1000);
console.log(date.toISOString()); // 2025-01-01T00:00:00.000Z

Milliseconds → Date

const date = new Date(1735689600000);
console.log(date.toISOString());

Get a UTC string

new Date(1735689600 * 1000).toUTCString();
// → "Wed, 01 Jan 2025 00:00:00 GMT"

Get an ISO 8601 string

new Date(1735689600 * 1000).toISOString();
// → "2025-01-01T00:00:00.000Z"

Convert Date to epoch

All Date objects have `.getTime()` (ms) and `.valueOf()`. For seconds, divide.

Current Date → seconds

Math.floor(new Date().getTime() / 1000);
// or the shorter equivalent:
Math.floor(Date.now() / 1000);

From a date string

Math.floor(new Date("2025-01-01T00:00:00Z").getTime() / 1000);
// → 1735689600

From components

// Be careful — months are 0-indexed in JavaScript!
const ms = Date.UTC(2025, 0, 1, 0, 0, 0); // January 1, 2025 UTC
Math.floor(ms / 1000);

Format with Intl.DateTimeFormat

Native browser API for locale-aware, timezone-aware formatting. No library needed.

Format for a specific timezone

const ts = 1735689600;
const formatter = new Intl.DateTimeFormat('en-US', {
  timeZone: 'America/New_York',
  year: 'numeric', month: 'short', day: '2-digit',
  hour: '2-digit', minute: '2-digit', second: '2-digit',
  hour12: false, timeZoneName: 'short'
});
formatter.format(new Date(ts * 1000));
// → "Dec 31, 2024, 19:00:00 EST"

List all IANA timezones

// Modern browsers (2022+):
Intl.supportedValuesOf('timeZone');
// → ["Africa/Abidjan", "Africa/Accra", ...] (400+ zones)

Get the browser's timezone

Intl.DateTimeFormat().resolvedOptions().timeZone;
// → "America/New_York"

Parse common formats

Native `Date` parsing accepts ISO 8601 and RFC 2822. For other formats, parse manually.

ISO 8601 (recommended)

new Date("2025-01-01T00:00:00Z").getTime();
// Always parseable across browsers

RFC 2822

new Date("Wed, 01 Jan 2025 00:00:00 GMT").getTime();
// Also parseable, but slightly slower

Date-only strings (use ISO 8601)

// SAFE — parsed as UTC midnight
new Date("2025-01-01").getTime();

// AMBIGUOUS — parsed differently by different browsers
// Avoid: new Date("01/01/2025")

Common gotchas

Where JavaScript date handling will trip you up.

Months are 0-indexed

// new Date(2025, 0, 1) is January 1
// new Date(2025, 11, 31) is December 31
new Date(2025, 0, 1); // ✓ January

Date-only strings without Z are local

// "2025-01-01" → midnight UTC
// "2025-01-01T00:00" → midnight LOCAL
// Always append Z or an offset:
new Date("2025-01-01T00:00:00Z");

getMonth() vs getDate()

// .getMonth() returns 0-11
// .getDate() returns 1-31
// .getDay() returns 0-6 (day of week!)
const d = new Date();
[d.getMonth(), d.getDate(), d.getDay()];

toISOString() always returns UTC

// Even if your Date was constructed from a local time,
// toISOString() always shows UTC with the Z suffix.
new Date(2025, 0, 1).toISOString();
// → "2024-12-31T..." (if you're west of UTC)

Use the converter

Need to quickly check what a specific timestamp converts to? Use the main converter — paste any value and get every format back.

Working with many timestamps at once? Try the batch converter — paste a list, get a CSV or JSON file back.