What is Unix Timestamp? Complete Guide with Examples

3 min readconverter

A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — known as the Unix epoch. For example, timestamp 1700000000 represents November 14, 2023. Unix timestamps provide a timezone-independent way to represent moments in time as simple integers, making them ideal for computers to store, compare, and calculate time differences.

Try It Yourself

Use our free Unix Timestamp Converter to experiment with unix timestamp.

How Does Unix Timestamp Work?

Unix time counts seconds continuously from the epoch, ignoring leap seconds. At any moment, the current Unix timestamp is the same worldwide — it's always UTC-based. To display a human-readable time, the timestamp is converted to a date/time in the viewer's timezone. The conversion involves calculating years, months, days, hours, minutes, and seconds from the total seconds, accounting for leap years. Most systems use 64-bit signed integers, supporting dates from billions of years in the past to the future. JavaScript's Date.now() returns millisecond timestamps (multiply by 1000).

Key Features

  • Timezone-independent representation — same number worldwide regardless of local time
  • Simple arithmetic for time calculations: duration = timestamp2 - timestamp1 in seconds
  • Compact integer storage compared to date string representations
  • Universal support across all operating systems, databases, and programming languages
  • Millisecond precision variants in JavaScript (Date.now()) and Java (System.currentTimeMillis())

Common Use Cases

Database Timestamps

Databases store creation and modification times as Unix timestamps for timezone-independent storage. Application code converts to local time for display.

API Responses

REST APIs return timestamps as integers in JSON responses. This avoids timezone and date format ambiguity — the client converts to the user's local timezone for display.

Token Expiration

JWTs and session tokens use Unix timestamps for expiration (exp claim). Comparing current time to the expiry timestamp is a simple integer comparison.

Frequently Asked Questions

Related Guides

Related Tools