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-5
Help & feedback
Convert from

Seconds or milliseconds since January 1, 1970 UTC.

Result

Timezone
—
Offset
—

Other formats

Convert a time to see its formats.

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.

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.000Z

Why 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.

For conversion issues, include your input, selected time zones, and the result you expected. Maximum 2,000 characters.

Your feedback and optional email are stored privately for review. Include your email if you would like a reply. Please don’t include passwords or other sensitive information.