Order time shows 1970 in the order list but exports correctly to Excel: fix the page first or unify the API unit first?
Conclusion: A 10-digit timestamp counts in seconds, and a 13-digit timestamp counts in milliseconds; when the page shows 1970, it is usually not that the backend omitted three digits, but that some layer parses seconds as milliseconds, or fields in the same API already use inconsistent units. Align the unit first, then handle formatting and time zones; simply multiplying by 1000 on the page often just moves the error to another place.
1. The difference between 10 digits and 13 digits is more than three digits
A Unix timestamp records the time elapsed since 1970-01-01 00:00:00 UTC. Counting in seconds is commonly 10 digits, and counting in milliseconds is commonly 13 digits; they differ by a factor of 1000, not a display difference that can be fixed by casually adding zeros. As long as one place in the API, database, message body, or logs uses a different unit, display, sorting, and expiration checks will go wrong accordingly.
The unit is part of the API contract, not a formatting detail. According to common project delivery practice in 2026, some scripting languages, legacy APIs, and the database UNIX_TIMESTAMP function often return seconds; browser Date.now and many Java ecosystem APIs often return milliseconds. When two systems integrate, this is a relatively common mismatch.
- Seconds level: smaller values, common in legacy APIs, open platform signature parameters, and return values of some database functions.
- Milliseconds level: commonly used by frontend Date, some backend frameworks, analytics events, and log timestamps.
- String time: ISO 8601 with time zone offset, readable, but sorting and comparison require extra handling.
The basis for judgment is not whether the number length looks good, but whether the contract says this field is in seconds or milliseconds; if the unit is not stated clearly, callers can only guess.
2. When the page shows 1970, first identify which layer changed the unit
If a seconds-level value is passed directly to a constructor that parses milliseconds, the result will land around January 1970; conversely, treating milliseconds as seconds will jump far into the future. The two errors go in different directions, but the root cause is the same: the unit was not confirmed before parsing.
When troubleshooting, do not start with page styles; compare the raw API return value, the database value, and the displayed value side by side, then check whether serialization, gateway conversion, or SDK default handling occurs in between. Many problems are not caused by a piece of code being wrong, but by two defaults colliding on the path.
Common paths
- The backend returns seconds, and the frontend calls new Date(value) directly without multiplying by 1000.
- A gateway or BFF truncates milliseconds to 10 digits for consistency, losing precision.
- In the same object, createdAt is in seconds and updatedAt is in milliseconds, but the frontend has only one formatting function.
- Excel export or CSV contains a timestamp, and operations staff open it in a spreadsheet that then converts it again as a date format.
If the page shows 1970 but the Excel export is correct, the two entry points use different parsing paths for the same field; at this point, do not rush to change the formatting function. First confirm which path performs normalization and which path still trusts the field name.
3. A time-field normalization in a delivery scenario: constraints, approach, and cost
The constraints were: the legacy API returned seconds; the frontend list, detail, and export entry points were already rolled out; the schedule was only about two days; and the API protocol could not be changed externally right away. The approach was to first unify seconds to milliseconds at the gateway serialization layer, keep the field names, and add unit descriptions to the API documentation; the export module no longer formatted on its own but reused the same normalized value for replay.
As a result, the page and export matched, reducing a class of cross-client disputes; the cost was an extra round of integration testing and compatibility confirmation for old clients. According to common delivery experience in 2026, the experience range for this kind of normalization is usually 1 to 2 days; when there are many APIs or external callers are involved, the typical range extends to 3 to 5 days. A quick fix that only patches a single page has a typical range of half a day to 1 day, but the risk of recurrence is higher.
4. A verifiable comparison of three approaches
There are commonly three paths, with different costs and risks; there is no need to start with a full-scale refactor. According to common project delivery practice in 2026, short-term stabilization and long-term contract work can be separated.
- Option A: Frontend compatibility by digit count: if it is 10 digits, multiply by 1000. Low cost, with an experience range of half a day to 1 day; suitable when the legacy API cannot be changed in the short term. The risk is that if the API changes from seconds to milliseconds, it will be multiplied twice.
- Option B: Unify the API unit and write it into the contract: change the serialization layer and documentation. Experience range 1 to 3 days, depending on the number of APIs; suitable for APIs shared by multiple clients and exposed externally. The cost is regression testing for all callers.
- Option C: Return ISO 8601 strings directly: good readability, with clear meaning across time zones; the modification cost depends on the compatibility surface, with a typical range of 2 to 5 days, and old clients need to be upgraded in sync.
If there is only a small internal tool with a single caller, Option A is enough; as soon as the API must serve multiple clients or external partners, Option B saves more communication later.
5. Applicable and non-applicable boundaries
Suitable cases: multiple clients displaying the same set of times, cross-time-zone users, externally exposed APIs, logs and analytics events that need time-based sorting, and payments and order timeouts that require precise judgment. In these scenarios, a wrong unit affects more than display; it may also affect timeout closure and state transitions.
Cases where a heavy solution is unnecessary: one-off data repair scripts, single-machine internal tools, and systems where the entire path already uses milliseconds consistently and has test coverage. Changing all time fields in the database for a single page usually does not justify the risk. The boundary can be summarized in one sentence: unify only when unit inconsistency affects display and judgment; if it affects only one piece of copy and will not expand, treat it with a smaller change.
During acceptance, compare the raw API value, database value, page value, and export value side by side, and confirm that null and 0 are handled separately; this makes it easier to find at which step the unit was changed than just staring at page screenshots.
Frequently asked questions
Can a 10-digit timestamp just be multiplied by 1000 for now?
It can serve as a short-term fix, suitable when there are few callers and the legacy API cannot be changed for now; but if the API later changes to milliseconds, it will be multiplied again. It is advisable to keep the judgment at the boundary layer and record the fields pending unification.
If the page shows 1970, did the backend omit three digits?
Most often it is not that three digits were omitted, but that a seconds-level value is parsed as milliseconds, or fields in the same API use inconsistent units; first compare the raw API value, database value, and page value side by side, then decide which layer should normalize.
In the same API, some times are normal while others become 1970; where should I check first?
First check whether units are mixed at the field level, then check whether the serializer and formatting function are written for only one unit; when seconds and milliseconds are mixed in the same object, a single frontend function is likely to be correct for only half the fields.
Is it easier to store datetime or a timestamp in the database?
According to common delivery practice in 2026, transaction time can be stored as datetime or UTC, while timestamps are suitable for sorting and cross-system transfer; the key is to document the conversion points across storage, transfer, and display, rather than relying on verbal agreements.
If users in different time zones see different times, should that be changed as well?
Showing the same instant in the user's local time zone is usually normal; ensure that storage and transfer use the same baseline, and the display layer is only responsible for formatting. If the page shows 1970, handle the unit first, not the time zone.
-
Detail page images looked fine at launch, but days later customers see broken images—are private bucket signed links expiring?
Date: Nov 23, 2026 Read: 4
-
After the certificate is renewed and replaced, why does the client’s phone still show “not secure”—is the cache not refreshed?
Date: Nov 21, 2026 Read: 12
-
Invoice PDF only flashes when tapped in WeChat, but opens normally in a mobile browser—do we still need to change anything?
Date: Nov 20, 2026 Read: 17
-
Small Excel Exports Open but a Large One with Tens of Thousands of Rows Says the File Is Corrupted: Is the Large File Being Truncated Mid-Transfer?
Date: Nov 19, 2026 Read: 21
-
Bulk import stops midway with a duplicate phone number—should the records that already succeeded be rolled back or kept for the rest of the import?
Date: Nov 18, 2026 Read: 23




