For a Unix timestamp in seconds, multiply by 1,000 before passing it to JavaScript’s Date constructor: new Date(unixSeconds * 1000). JavaScript date values use milliseconds, so passing seconds directly usually produces a date near the start of 1970.
Convert Unix seconds to a JavaScript Date
A common Unix timestamp counts seconds since 1970-01-01 00:00:00 UTC. JavaScript’s numeric Date time value counts milliseconds from that epoch. Multiply seconds by 1,000 to convert the unit:
As an Amazon Associate I earn from qualifying purchases.
const unixSeconds = 1_700_000_000;
const date = new Date(unixSeconds * 1000);
console.log(date.toISOString());
// 2023-11-14T22:13:20.000Z
The multiplication changes seconds into milliseconds; it does not convert the instant to another time zone. A JavaScript Date represents an instant. The method used to display it determines the time-zone presentation. MDN explains the millisecond representation in its guide to representing dates and times.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesCheck whether the input is seconds or milliseconds
Do not multiply a timestamp that is already in milliseconds. Apply the conversion at the point the value enters your application, based on the source’s contract rather than an unexplained guess about its size.
#1 Best Overall
- Seconds:
new Date(timestamp * 1000) - Milliseconds:
new Date(timestamp)
const seconds = 1_700_000_000;
const milliseconds = 1_700_000_000_000;
const fromSeconds = new Date(seconds * 1000);
const fromMilliseconds = new Date(milliseconds);
The constructor matters: use new Date(value) to create a date from a numeric timestamp. Calling Date(value) without new returns the current date-time as a string and ignores the supplied argument. See MDN’s Date() constructor reference.
Choose the right output and time zone
Use the output method that matches the consumer. For stable, machine-readable UTC text, call toISOString(); its result ends in Z. For people, use toLocaleString(). If the display must follow a particular region’s time-zone rules, pass an explicit IANA time-zone identifier rather than relying on the computer’s configured zone.
Rank #2
| Need | Use | Time-zone behavior |
|---|---|---|
| Standard UTC string for data exchange | date.toISOString() |
UTC; ends in Z |
| Display in the runtime’s local zone | date.toString() |
Uses the host’s local time zone |
| Localized display in a chosen region | date.toLocaleString("en-US", { timeZone: "America/Los_Angeles" }) |
Uses the specified zone’s rules |
const date = new Date(unixSeconds * 1000);
const utcText = date.toISOString();
const localText = date.toLocaleString("en-US", {
timeZone: "America/Los_Angeles",
});
Local display can show a different clock time or calendar date from UTC, depending on the zone. For details, see MDN’s references for toISOString() and toString().
Validate the timestamp and handle edge cases
A numeric value outside JavaScript’s supported Date range, or a value that cannot produce a valid date, results in an invalid Date. The supported range is ±8,640,000,000,000,000 milliseconds from the epoch. Check the resulting time value with Number.isNaN(date.getTime()) before using it:
function dateFromUnixSeconds(unixSeconds) {
const date = new Date(unixSeconds * 1000);
if (Number.isNaN(date.getTime())) {
throw new RangeError("Timestamp is outside the supported Date range");
}
return date;
}
Negative timestamps are valid when they fall within the supported range; they represent instants before 1970-01-01 UTC. Fractional seconds may also be supplied. If a source system specifies how fractional values must be rounded or truncated, follow that contract; do not silently impose a rounding rule of your own. MDN documents the constructor’s supported range and invalid-date behavior.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Why does my JavaScript date show 1970?
The usual cause is passing a seconds-based Unix timestamp directly to new Date(). The constructor interprets a number as milliseconds, so a seconds value is treated as a much smaller interval after the epoch. If the input is in seconds, use new Date(timestamp * 1000); if it is already in milliseconds, pass it directly. Numeric timestamps can be converted without Date.parse() or an intermediate date string.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




