"Token expired." The user swears they just logged in. Or the opposite complaint: a session that should have ended hours ago is still alive, or a cache entry that refuses to refresh long after its lifetime should have run out. Behind almost every one of these bugs sits a single number, an expiry timestamp, and the fastest way to understand it is to convert it and look at the date it actually names.
This guide works through that debugging routine: find the expiry value, convert it with the Unix Timestamp Converter, compare it against now, and check the two traps that cause most false verdicts, the wrong unit and the wrong time zone.
Contents
- Quick answer
- Where expiry values hide
- Step by step: the debugging routine
- Worked example: an exp claim that expired long ago
- Trap one: milliseconds read as seconds
- Trap two: the local line read as UTC
- Limitations
- Common mistakes
- FAQs
- Conclusion
Quick answer
Take the expiry value exactly as stored, paste it into the Unix Timestamp Converter, and read the UTC line: that is the real deadline. Then press Use current time in the same converter and compare. If the converted date is absurd, in 1970 or tens of thousands of years ahead, the value was read in the wrong unit: count the digits, 10 for seconds and 13 for milliseconds, and force the right unit in the selector.
Where expiry values hide
Expiry deadlines are stored as Unix timestamps because one number names one moment on every machine. You will find them in the payload of a token, where the exp claim records when the token stops being valid, in seconds since the epoch. You will find them in API responses and database rows that record when a session, a reset link or a cached response expires. And you will find them in logs, where the gap between the event time and the expiry time is often the whole story.
If the value came from a token, the JWT Decoder shows the claims inside it, including the exp value you need. From there, the debugging is all about the number itself.
Step by step: the debugging routine
- Copy the expiry value exactly as stored, without rounding or reformatting it.
- Paste it into the Unix Timestamp Converter. Leave the unit on Auto-detect for the first reading; the converter treats values of 1 trillion or more as milliseconds and smaller values as seconds, and shows which unit it used.
- Read the UTC line and the relative description. That is the deadline the system wrote down.
- Press Use current time to get the present moment in the same tool, and compare the two values. Expiry before now means the deadline has genuinely passed; expiry after now means the value is not the problem.
- If the converted date looks absurd, work through the two traps below before changing any code.
Worked example: an exp claim that expired long ago
A support report says a token is rejected as expired the moment it is issued. The exp claim inside it reads 1735689600. Pasted into the converter, that value gives:
- UTC: Wednesday, 1 January 2025 at 00:00:00 UTC
- ISO 8601:
2025-01-01T00:00:00.000Z
The deadline is real, and it is long past. Nothing is wrong with the check that rejected the token; the value itself was written for a moment in the past, which points the investigation at whatever issued the token, not at the code verifying it. That is the usual shape of these bugs: the conversion takes ten seconds, and it tells you which half of the system to go and read.
Trap one: milliseconds read as seconds
Now suppose the expiry arrives as 1735689600000 instead. That is the same deadline, 1 January 2025, expressed in milliseconds, which is what JavaScript-based systems naturally produce. Read those 13 digits as seconds and the date lands in the year 56971: an expiry so far in the future that the token looks valid forever, and nothing ever gets rejected.
The reverse mistake is just as destructive. A seconds value like 1735689600, fed to something that reads it as milliseconds, converts to Wednesday, 21 January 1970, twenty days after the epoch. Every check concludes the deadline passed decades ago, and every token looks expired on arrival.
The digit count is the tell, and the converter is built around it: it auto-detects from length and reports the unit it chose. When a deadline matters, force the unit in the selector and confirm the date matches what the issuing system intended.
Trap two: the local line read as UTC
The second trap is quieter. The converter shows the same moment three ways: UTC, ISO 8601 and your local time. The local line applies your device's time zone, so for the deadline above, a reader five hours ahead of UTC sees 05:00 on 1 January 2025 where the UTC line says 00:00.
Both readings are correct, but comparing one system's local reading against another's UTC deadline shifts the verdict by the zone offset. A token can look valid for five extra hours, or dead five hours early, purely because two people read different lines. Debug expiry times on the UTC or ISO line, which are zone-free, and keep the local line for human context only.
Limitations
Converting an expiry value tells you what deadline was written, not whether the system enforced it correctly, and not whether the token or session carrying it is genuine. It also cannot see the clock of the server that issued or checks the value: if that clock is skewed, the timestamp faithfully records the skewed moment. And the converter reports values beyond the range JavaScript dates support, about 275,000 years either way, as errors, so an error on a supposed expiry value is itself a clue that the number was never a timestamp.
Common mistakes
- Debugging the code before the value. Convert the stored expiry first. Half of all expiry bugs are a bad number, not bad logic.
- Comparing values in different units. An exp in seconds held against a now in milliseconds will always look long past. Convert both, or count both digit lengths.
- Trusting the local line for a deadline. Local displays differ by reader. The UTC line is the shared reference every system agrees on.
- Retyping the value. A transposed digit in a 13 digit number moves the deadline by centuries. Copy and paste the exact stored value.
FAQs
Where do I find the expiry value to check? Look wherever the deadline was stored: the exp claim inside a token's payload, an expiry field in an API response, a session record or a cache entry. It will be a plain number, a count of seconds or milliseconds since the Unix epoch.
Is an expiry timestamp in seconds or milliseconds? Both forms exist, and the digit count tells them apart: current values in seconds have 10 digits, in milliseconds 13. JWT exp claims, for example, are written in seconds. The converter auto-detects the unit and shows which one it used.
The converted expiry lands in 1970 or in the far future. What went wrong? Almost always a unit mix-up. A seconds value read as milliseconds collapses to January 1970, and a milliseconds value read as seconds lands tens of thousands of years ahead. Force the correct unit in the converter's selector and read the date again.
Why does the expiry look a few hours off? You are probably reading the local line as if it were UTC. The moment is the same; only the display changes with time zone. Compare expiry deadlines on the UTC or ISO line, which are zone-free.
The expiry converts to a future date, but the system still says expired. What else can it be? Then the value you converted may not be the value the system is checking: a stale copy, a different field, or a deadline the server compares against its own clock. The converter tells you what the number means; tracing which number the system actually reads is the next step.
Conclusion
Expiry debugging is mostly arithmetic hygiene: convert the stored value, read its UTC line, compare it with a fresh current timestamp, and suspect the unit and the zone before you suspect the code. The companion guide How to Get the Current Unix Timestamp covers the "now" side of that comparison in detail, and the Developer Tools archive collects the related format and encoding guides.