Timeplain
JavaScript Timestamp Converter
Convert Unix timestamps to JavaScript dates. Get Date and timezone formatting examples, ISO strings, and help with seconds versus milliseconds.
Convert Unix seconds to a JavaScript Date
JavaScript Date takes milliseconds since the Unix epoch. Multiply Unix seconds by 1,000 before creating the date. This example uses 1700000000 seconds and displays the same instant in UTC and America/New_York.
// JavaScript Date takes milliseconds, not Unix seconds.
const timestampMs = 1700000000000;
const date = new Date(timestampMs);
const timeZone = "America/New_York";
console.log(date.toISOString());
console.log(new Intl.DateTimeFormat('en-GB', {
timeZone,
dateStyle: 'full',
timeStyle: 'long',
}).format(date));Expected output
2023-11-14T22:13:20.000Z
Tuesday, 14 November 2023 at 17:13:20 GMT-5Result
- Timezone
- —
- Offset
- —
Earlier occurrence
—
- Timezone
- —
- Offset
- —
- Unix timestamp
- —
Later occurrence
—
- Timezone
- —
- Offset
- —
- Unix timestamp
- —
Other formats
Convert a time to see its formats.
- Unix seconds
—- Unix milliseconds
—- ISO 8601 — UTC
—- ISO 8601 — destination timezone
—- RFC 3339 — UTC
—- HTTP date — GMT
—
Earlier occurrence
- Unix seconds
—- Unix milliseconds
—- ISO 8601 — UTC
—- ISO 8601 — destination timezone
—- RFC 3339 — UTC
—- HTTP date — GMT
—
Later occurrence
- Unix seconds
—- Unix milliseconds
—- ISO 8601 — UTC
—- ISO 8601 — destination timezone
—- RFC 3339 — UTC
—- HTTP date — GMT
—
ISO 8601 and RFC 3339 UTC values match for ordinary dates. HTTP dates use whole seconds. RFC 3339 and HTTP dates require a four-digit year.
Show JavaScript code for your converted time
Your converted time in JavaScript
Generate JavaScript Date and Intl.DateTimeFormat code for the resolved instant and destination timezone.
Convert a time to generate an example.
Expected output
Earlier occurrence
Expected output
Later occurrence
Expected output
Display text and timezone rules can vary with runtime locale data. Repeated local times produce two examples. Generated code reproduces resolved instants; it does not validate arbitrary local-time input.
Convert an ISO date to a Unix timestamp
const date = new Date("2023-11-14T22:13:20Z");
console.log(date.getTime()); // 1700000000000 milliseconds
console.log(Math.floor(date.getTime() / 1000)); // 1700000000 seconds
console.log(date.toISOString()); // 2023-11-14T22:13:20.000ZWhy does my timestamp show a date in 1970?
A common cause is passing Unix seconds directly to new Date(). The value 1700000000 is interpreted as milliseconds, giving a date near the start of 1970. Select Seconds or Milliseconds explicitly in the converter when you know your input's unit.
UTC and local display are different
A Date stores an instant, not a named timezone. toISOString() returns UTC with a Z suffix. Use Intl.DateTimeFormat with an explicit timeZone for a named-zone display. Formatting text may vary by locale and runtime even when the instant is identical.
Include Z or an explicit offset in date-time strings when you intend a specific instant. For local wall-clock input and daylight-saving ambiguity, use the time zone converter. The generated code reproduces resolved instants; it does not validate arbitrary local input.
Reference: ECMAScript Date specification.
Feedback
Have a suggestion, spotted a problem, or need another date format? Help shape what comes next for Timeplain.