Unix Timestamp Explained: Seconds, Milliseconds, UTC, and Dates

Understand Unix timestamps, UTC, seconds versus milliseconds, and the common mistakes that cause wrong dates in APIs, logs, and databases.

For the hands-on step, inspect a Unix timestamp as a date first, then use turn a date into a Unix timestamp when your workflow moves in the opposite direction or into a nearby format.

Use The Tool

This guide supports the Unix Timestamp to Date tool. Use the tool for the actual conversion or formatting step, then use this page to understand the method, edge cases, and next actions.

If the result points to a second task, convert seconds into minutes gives you a focused next step without returning to the full tool library.

What A Unix Timestamp Is

A Unix timestamp is a number that represents time as a count from the Unix epoch: 1970-01-01 00:00:00 UTC. In many systems, the value is counted in seconds. In JavaScript and some APIs, similar timestamp values may be counted in milliseconds.

Developers use timestamps because they are compact, easy to compare, and independent from human date formatting. A timestamp can be sorted, stored, and transmitted without worrying about whether a user writes dates as month/day/year or day/month/year.

The readable date is created later by interpreting the timestamp with a timezone and display format. That interpretation step is where many bugs appear.

For a related check from this point, convert minutes into hours keeps the next action connected to the same topic.

UTC And Local Time

UTC is the safest baseline for technical time storage. Logs, databases, background jobs, and APIs often use UTC so teams in different regions can compare the same moment without local clock confusion.

Local time is useful for user interfaces, calendars, appointment reminders, and reports intended for a specific audience. The problem begins when a value is stored in UTC but displayed as local time without a label, or when a local date is converted as if it were UTC.

For a related check from this point, format JSON for review keeps the next action connected to the same topic.

Timestamp Concepts

Concept Meaning Risk
Epoch 1970-01-01 00:00:00 UTC Wrong baseline creates impossible dates
Seconds timestamp Common Unix timestamp unit Often 10 digits for current dates
Milliseconds timestamp Common JavaScript Date unit Often 13 digits for current dates
UTC Timezone-neutral reference Can look shifted when displayed locally
Local time Clock time for a region Needs timezone context

Real-World Applications

In API debugging, timestamps often appear in JSON fields such as created_at, expires_at, issued_at, or updated_at. Converting the timestamp helps confirm whether a token, cache entry, or scheduled event is valid.

In analytics, timestamps define reporting windows. A one-hour timezone mistake can move data into the wrong day, which can make charts and exports disagree with a dashboard.

In databases, timestamps help sort events reliably. Storing comparable timestamp values is easier than storing many regional date strings, but display logic must still handle the correct timezone.

In support tickets, sharing both the timestamp and the converted readable date makes reproduction easier. It also helps teams compare server logs and user reports without guessing local time.

Common Mistakes

  • Confusing a 13-digit millisecond timestamp with a 10-digit seconds timestamp.
  • Displaying a UTC timestamp as local time without saying so.
  • Creating a timestamp from a calendar date without specifying timezone.
  • Using an inclusive end date when the system expects an exclusive upper bound.
  • Editing timestamp digits manually instead of converting from the source date.

When To Use Each Timestamp Workflow

Use timestamp-to-date conversion when you are reading logs, inspecting API responses, checking token expiration, reviewing database records, or debugging scheduled events.

Use date-to-timestamp conversion when you need to create a test payload, define an analytics filter, schedule a future job, or prepare an API request that expects numeric time.

Use duration converters when the number represents elapsed time rather than a specific date. Seconds, minutes, hours, and days describe durations, while Unix timestamps describe points in time.

Practical Debugging Rules

  • Count the digits before converting: current seconds timestamps are usually 10 digits, milliseconds often 13.
  • Label UTC and local time explicitly in notes.
  • Keep original timestamp values in bug reports.
  • Confirm API documentation before sending seconds or milliseconds.
  • Use readable date conversion for review, not as a replacement for source data.

Practical Insights For APIs And Logs

When debugging an API, compare the converted timestamp with the event you expected to happen. If the date is close but shifted by hours, suspect timezone display. If the year is wildly wrong, suspect seconds versus milliseconds.

For scheduled jobs, document both the intended local time and the timestamp sent to the system. This gives reviewers a human-readable intent and a machine-readable value to compare.

For analytics windows, prefer clear boundaries. Many teams use an inclusive start timestamp and an exclusive end timestamp so reports do not double-count records at midnight.

Practical Insights For Timestamp Reviews

When a timestamp appears in a support ticket, copy the original number before converting it. Screenshots and notes should preserve the raw value, because a readable date can be affected by timezone settings, browser locale, or the tool used for review.

For API documentation, say whether the field expects seconds or milliseconds. A sample value is useful only if the unit is obvious. Current seconds timestamps are shorter than millisecond timestamps, but relying only on digit count can still fail for old, future, or truncated values.

For database exports, include timezone information in column names or documentation. A column named created_at_utc is easier to audit than a column named date, especially when teams compare reports across regions.

For scheduled tasks, review daylight saving behavior before launch. Unix timestamps represent moments, but business rules such as run this every day at 9 AM belong to local calendar time and may shift around daylight saving changes.

Related Tools

Explore The Full Category

Need another related task? Open Time Converter for the full tool set, quick-reference examples, and related category paths.