Skip to main content
Basics

Timestamp

timestamp

Definition

A timestamp is a piece of data that records the precise moment an event occurred. Timestamps appear everywhere: log file entries, database record creation times, file modification dates, and financial trade execution times all rely on timestamps to answer the question "when did this happen?" Common representations include Unix timestamps (integers), ISO 8601 strings, and database-native datetime types.

Common Formats

Unix timestamp: the number of seconds elapsed since 1970-01-01T00:00:00Z (e.g., 1747310400). Compact and easy to compute with. ISO 8601 string: human-readable and unambiguous (e.g., 2026-05-15T16:00:00+09:00). RFC 2822: used in email headers (e.g., Fri, 15 May 2026 16:00:00 +0900). Database types: PostgreSQL's TIMESTAMPTZ, MySQL's DATETIME, and similar native date-time columns.

Best Practices

Timestamps should always include timezone information. A bare timestamp without a timezone (e.g., 2026-05-15 16:00:00) is ambiguous and a common source of bugs. The standard design pattern is to store all timestamps in UTC and convert to the user's local time only at display time. Precision (seconds, milliseconds, or microseconds) should be consistent across the entire system to avoid subtle comparison errors.

XB!LINE

Was this article helpful?

Related Terms

Related Articles