JavaScript Timestamp Converter

Current Unix Time
Advertisement

JavaScript Timestamp Converter

JavaScript handles time using milliseconds as its native unit — unlike most other languages which default to seconds. A JavaScript timestamp from Date.now() is a 13-digit number representing milliseconds since January 1, 1970 UTC. This is sometimes called a "JavaScript timestamp" or "JS timestamp" to distinguish it from the standard 10-digit Unix seconds timestamp.

Understanding this milliseconds-vs-seconds distinction is crucial. When you receive a Unix timestamp in seconds from a server and want to create a JavaScript Date object from it, you must multiply by 1000 first: new Date(ts * 1000). Forgetting this multiplication is one of the most common JavaScript date bugs, resulting in dates showing as 1970.

JavaScript timestamp cheat sheet

Get current timestamp (milliseconds): Date.now()
Get current timestamp (seconds): Math.floor(Date.now() / 1000)
Millisecond timestamp to Date: new Date(timestamp)
Second timestamp to Date: new Date(timestamp * 1000)
Date to millisecond timestamp: date.getTime()
Date to second timestamp: Math.floor(date.getTime() / 1000)
ISO string from timestamp: new Date(ts * 1000).toISOString()
Local string from timestamp: new Date(ts * 1000).toLocaleString()
UTC string from timestamp: new Date(ts * 1000).toUTCString()

Timezone-aware formatting in JavaScript

Use the Intl.DateTimeFormat API for locale-aware, timezone-specific formatting:
new Intl.DateTimeFormat('en-GB', { timeZone: 'Europe/Oslo', dateStyle: 'full', timeStyle: 'long' }).format(new Date(ts * 1000))

Advertisement
// Epoch → Human-readable date

Auto-detects seconds (10 digits), milliseconds (13), microseconds (16), nanoseconds (19)

Invalid timestamp. Please enter a numeric Unix timestamp.
// Date → Epoch timestamp
Please check the values — year (1970–9999), month (1–12), day (1–31), hour (0–23), min/sec (0–59).

Or paste a date string:

Could not parse that date string.
Advertisement

← Back to all tools

Copied!