How I read Unix timestamps without guessing seconds or milliseconds
· 2 min read
A timestamp bug often starts with one question: is this value in seconds or milliseconds? Getting that wrong can move dates to 1970 or far into the future.
The Timestamp Converter tool is useful because it lets me check the result in a small, controlled place before I use it in a bigger workflow.
The simple idea
A timestamp bug often starts with one question: is this value in seconds or milliseconds? Getting that wrong can move dates to 1970 or far into the future.
The goal is not to click buttons quickly. The goal is to understand the input, produce the expected output, and notice anything that could be misleading.
Step 1: Paste the timestamp
Paste the timestamp.
Start with a small example if possible. Small examples make mistakes easier to see.
Step 2: Check whether it looks like seconds or milliseconds
Check whether it looks like seconds or milliseconds.
Step 3: Convert to UTC and local time
Convert to UTC and local time.
Step 4: Compare with the event you expected
Compare with the event you expected.
Step 5: Convert ISO strings back to Unix time when needed
Convert ISO strings back to Unix time when needed.
Step 6: Be explicit about time zone when sharing results
Be explicit about time zone when sharing results.
Step 7: Store timestamps consistently in systems, usually UTC
Store timestamps consistently in systems, usually UTC.
My checklist
Before I trust the result, I check:
- Paste the timestamp.
- Check whether it looks like seconds or milliseconds.
- Convert to UTC and local time.
- Compare with the event you expected.
- Convert ISO strings back to Unix time when needed.
- Be explicit about time zone when sharing results.
- Store timestamps consistently in systems, usually UTC.
The tool handles the mechanical part. I still review the result before I publish it, send it, or use it in production.
Comments
Comments are welcome — please read the comment policy first. Powered by giscus and GitHub Discussions.