What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
If a modern date suddenly appears in 1970, check whether a timestamp in seconds was passed to JavaScript’s Date as though it were milliseconds. JavaScript interprets a numeric Date value as milliseconds since midnight UTC on January 1, 1970. If the source value is seconds, multiply it by 1,000; if it is already milliseconds, pass it through unchanged.
Why does a Unix timestamp show a date in 1970?
The Unix epoch is midnight UTC on January 1, 1970. Unix time is usually expressed as the number of seconds since that instant, while a numeric JavaScript Date value is expressed in milliseconds. MDN describes Unix time as usually counting seconds from the epoch (MDN: Unix time) and JavaScript dates as milliseconds elapsed since it (MDN: Date).
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Sharp 8-Digit Dual Power Pocket Calculator, Gray/Blue (EL-243SB) | $11.16 | Buy on Amazon |
That difference is a factor of 1,000. If you give Date a seconds value without converting it, JavaScript treats that small number as milliseconds after the epoch. The result is near January 1, 1970, rather than the intended modern date.
How do I convert seconds and milliseconds correctly?
First confirm the unit documented by the API, database field, or serialized payload. Then use the matching conversion:
#1 Best Overall
- PROTECTIVE HINGED COVER: Features a hinged, hard cover that protects the keys and display when stored, making this handheld calculator durable and easy to carry safely.
- DUAL-POWER SOURCE: Runs on solar energy with a battery backup, ensuring consistent and reliable use in any lighting condition or environment.
- LCD SCREEN SIZE: The 2-inch screen size, 8-digit LCD screen clearly shows each digit, helping to prevent reading errors and making numbers easy to read at a glance.
- CONVENIENT FUNCTION KEYS: Includes a 3-key independent memory, square root key, change sign key, automatic power down, and more to provide efficient, reliable everyday math.
- TRUSTED BY WORKPLACES FOR DECADES: Sharp has been a dependable name in office calculation for generations — practical tools built around the way people actually work.
| Source value | JavaScript handling |
|---|---|
| Seconds since the Unix epoch | Multiply by 1,000 before passing to Date. |
| Milliseconds since the Unix epoch | Pass directly to Date. |
| JavaScript milliseconds converted to whole seconds | Divide by 1,000; use Math.floor if you need the integer count of fully elapsed seconds. |
For example, if a documented field is seconds:
const seconds = 1_700_000_000;
const date = new Date(seconds * 1000);
By contrast, if the source already supplies milliseconds, use new Date(milliseconds). Scaling milliseconds again by 1,000 produces a value far beyond the intended instant and may result in an invalid or out-of-range date.
How can I diagnose the timestamp?
- Inspect the raw value and its type. Check the value before formatting or converting it, and determine whether it is a number or a string.
- Check the producer’s contract. Look up whether the source defines the field as seconds, milliseconds, microseconds, or another unit. The phrase “Unix timestamp” does not always settle precision; the field documentation does.
- Match the consumer’s expectation. JavaScript
Dateexpects milliseconds for numeric input. Convert only if the source documents seconds. - Check for accidental double-scaling. If the input is already milliseconds, remove the extra multiplication by 1,000.
- Check zero or missing values separately. A value of zero represents the epoch, but an application may also use zero as a “not set” sentinel. Whether that is true depends on that application’s semantics.
Digit count can offer a clue, but it is not proof: modern epoch timestamps are often about 10 digits in seconds and 13 in milliseconds, but the count depends on the date and other timestamp units or encodings exist. Verify both the epoch and unit in the source documentation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Could the timezone be the problem instead?
Timezone formatting can change the displayed clock time or calendar date, sometimes across a date boundary. JavaScript Date represents an instant, while common date and time component methods use the host’s local timezone. A timezone difference does not turn a near-epoch instant into a modern one.
If the timestamp appears to identify the right instant but the displayed time differs by hours, check whether the code is formatting in local time. For consistent UTC output, use UTC date getters or an explicit timezone formatter. See MDN’s JavaScript Date documentation for date behavior.
What if the value is zero or uses another timestamp system?
Zero milliseconds since the Unix epoch is a valid instant: midnight UTC on January 1, 1970. Some applications also assign zero a separate meaning, such as “not set,” so check the field’s application-specific contract before treating it as an event time.
Not every timestamp system uses the Unix epoch or seconds and milliseconds. Some use a different origin, unit, or encoding. Establish both the origin and precision from the source documentation before converting; multiplying by 1,000 is appropriate only when the value is seconds since the Unix epoch and the receiver expects milliseconds.
Quick Recap
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.
Recommended Free Tools

