Global Tools Hub
Current language: English
Back to guides

Guide

How to Spot a Seconds vs Milliseconds Timestamp Bug Quickly

Use a short checklist to identify seconds-vs-milliseconds bugs before they spread through logs and UI output.

Timestamp bugs are often obvious once you know what to inspect first. A two-minute unit check can prevent long debugging loops.

Start with the visual digit test

Most seconds timestamps are 10 digits and milliseconds are 13 digits.

This quick check solves many issues before deeper debugging.

Use one expected real-world timestamp

Convert one value where you already know the event time.

If result year or hour is absurd, unit is likely wrong.

Check both conversion directions

Convert timestamp to date and date back to timestamp.

Round-trip checks expose hidden assumptions in parsing logic.

  • Run test in UTC view.
  • Run same value in local view.
  • Compare with backend log output.

Inspect JavaScript and backend defaults

JavaScript Date constructors often expect milliseconds.

Many backend stores and APIs use seconds by default, so integration points need explicit conversion.

Add a guardrail for future payloads

Document expected unit in schema and enforce it with validation checks.

A small validator can stop repeated bugs across services.

Great for

  • Dates unexpectedly near 1970.
  • Future dates far beyond expected range.
  • APIs and frontend showing different event times.
  • Reviewing suspicious timestamps in incident logs.

Digit length check saves time

Start with digit length, then confirm one known value in UTC and local time.

Related tools

Timestamp Converter

Convert Unix seconds, Unix milliseconds, and readable date text both ways.

Open Timestamp Converter

More guides

Browse another short article to keep exploring practical workflows.