Developer Workflow

Convert timestamps from API logs and event payloads

Learn how to turn Unix epoch seconds, milliseconds, and microseconds from logs, JSON payloads, webhooks, and database rows into readable UTC and local dates.

Problem

API logs and event payloads often mix timestamp units. One service may emit epoch seconds, another JavaScript client may emit milliseconds, and a queue or database export may store microseconds. If you guess the unit manually, the converted date can be years away from the real event time.

When to use this

  • A JSON response or webhook payload contains fields such as created_at, updated_at, expires_at, issued_at, or processed_at.
  • A server log line has 10, 13, or 16 digit epoch values and you need to compare event order.
  • A database row stores epoch values and the UI shows a different date than expected.
  • A scheduled job or queue event needs to be compared with a UTC deployment or incident timeline.

Steps

  1. Step 1

    Copy the raw timestamp context

    Copy the timestamp value, JSON fragment, log line, or a few related log lines. Keep nearby field names such as created_at or updated_at because they make the converted output easier to verify.

  2. Step 2

    Paste into Unix Timestamp Converter

    Paste the value or log snippet into Unix Timestamp Converter. The tool detects likely epoch seconds, milliseconds, and microseconds without uploading the copied data.

  3. Step 3

    Check the detected unit

    Review whether each detected value was interpreted as seconds, milliseconds, or microseconds. A 10 digit current-era value is usually seconds, 13 digits is usually milliseconds, and 16 digits is usually microseconds.

  4. Step 4

    Compare UTC and local time

    Use UTC for logs, APIs, and incident timelines. Use local time only when comparing what a user saw in a browser or support screenshot.

  5. Step 5

    Follow related data

    If the timestamp is inside JSON, use JSON Formatter first. If it came from response headers, use HTTP Header Parser to keep date headers and cache behavior in the same debugging notes.

Example

Mixed timestamp units in one event payload

Input

{
  "created_at": 1704067200,
  "updated_at": 1704067200123,
  "processed_at": 1704067200123456
}

Output

1704067200 -> seconds -> 2024-01-01T00:00:00.000Z
1704067200123 -> milliseconds -> 2024-01-01T00:00:00.123Z
1704067200123456 -> microseconds -> 2024-01-01T00:00:00.123Z

Common mistakes

Assuming every timestamp is seconds

JavaScript clients and many APIs use milliseconds. Treating a 13 digit millisecond value as seconds produces a date far in the future.

Comparing local time to UTC logs

Most server logs and API events are easiest to compare in UTC. Local time is useful for user-facing screenshots, but it can confuse incident timelines.

Removing timestamp context too early

Keep field names and neighboring log lines while debugging. Knowing whether a value is created_at, expires_at, or processed_at changes the interpretation.

FAQ

How do I tell seconds, milliseconds, and microseconds apart?

Current-era Unix seconds are usually 10 digits, milliseconds are usually 13 digits, and microseconds are usually 16 digits. The converter detects these units conservatively and shows the detected unit for each row.

Should I use UTC or local time for API logs?

Use UTC when comparing server logs, deploy times, webhooks, queues, or database rows. Use local time only when matching what a user saw on their device.

Is pasted log data uploaded?

No. The timestamp conversion runs in your browser. You should still redact secrets before sharing copied output in tickets, pull requests, or screenshots.