flashman
← All posts

Timestamp empty Unix epoch debugging

Debug a Unix seconds field that reads an empty box as 1970-01-01, treats a 13-digit value as seconds, and floors ISO milliseconds down to a whole second.

2026-10-19 · 6 min read · Rahul Chitturi

  • time
  • unix
  • debugging

Flashman's timestamp tool has two boxes that do not update each other. The Unix box is seconds. The value is turned into a date with that number times 1000. The ISO box is parsed on its own, and the seconds under it are the floor of that instant's millisecond time divided by 1000.

An empty Unix box is not an empty result. Number of an empty string is 0, and 0 is a finite timestamp. The line under the box reads 1970-01-01T00:00:00.000Z.

Name the unit before you paste the digits

0 and the empty box are both the epoch. A space-padded 10 is 10 seconds, because the number parser trims, and the ISO line is 1970-01-01T00:00:10.000Z. 1.9 seconds is 1970-01-01T00:00:01.900Z. The fraction is kept on this side. 1e9 is accepted and is 2001-09-09T01:46:40.000Z.

A 13-digit millisecond value is still multiplied by 1000. 1700000000000 is the year 55840, printed as +055840-11-08T22:13:20.000Z. The same instant in seconds is 1700000000, which is 2023-11-14T22:13:20.000Z. abc and Infinity are the cases that show Invalid. A huge finite number does not.

  • Count digits. Ten is seconds. Thirteen is milliseconds.
  • Treat an empty Unix box as the epoch, not as unset.
  • Keep a fractional second on the Unix side if you typed one.
  • Reject a year in the five digits before you debug a timezone.

The ISO side floors, and local time is not Z

2026-10-19T00:00:00.900Z is the instant with 900 milliseconds, and the seconds line is 1792368000. The floor drops the .900. It does not round up to the next second. A date-only 2026-10-19 is UTC midnight and the same 1792368000.

A date-time with no zone is local. In America/New_York on that October date, 2026-10-19T00:00:00 is 2026-10-19T04:00:00.000Z, four hours later than the Z form. The container offset was 240 minutes. Copy the zone you intended into the string, or the seconds you copy will follow the browser timezone.

Now is the only control that writes both boxes

The Now button stores floor of the current millisecond time over 1000 in the Unix box, and the current toISOString value in the ISO box. Typing in one box leaves the other box where it was. Copy Unix copies the text in the Unix field, not the ISO line under it.

Use the timestamp tool to label seconds and an offset, the JSON formatter when that number is an exp or iat claim, and the cron tool when the question is the next run in a named timezone. Diff the original digits, the unit, and the ISO line. An empty box that became 1970 is a parse, not a missing log.

Try these tools