liveBook · Manning

Timestamp

As explained in Grokking Relational Database Design

A TIMESTAMP data type records a date and time representing an exact event moment, typically with automatic time-zone conversion by the database system.

TIMESTAMP records the exact moment an event occurs. Database systems typically convert its time zone automatically, making the value consistent across locations. section 4.8

Choose the temporal type that matches the information you need:

  • Use DATE for a date without a time, such as a birthday. section 4.8
  • Use TIME for a time without a date, such as 14:30:00. section 4.8
  • Use DATETIME when date and time should remain unadjusted, including historical or future events. section 4.8
  • Use TIMESTAMP for log events, record creation, and modification times that must remain consistent across time zones. section 4.8

Review timestamps

A review entity can use TIMESTAMP for its review_time attribute when the application must record the exact event moment. For globally used applications, storing values in UTC helps avoid inconsistencies caused by time zones, daylight saving changes, and traveling users. section 4.8

How Grokking Relational Database Design covers it

How deep it goes
Defines TIMESTAMP, contrasts related temporal types, and recommends UTC but defers implementation-specific behavior.
Examples
Uses review_time, log timestamps, and record creation or modification times as concrete examples.
What it assumes
Assumes basic database attributes and introduces temporal data types through practical distinctions.
What you can do after
Evaluate temporal requirements and choose TIMESTAMP when an event moment must remain consistent across time zones.
How it connects
Connects TIMESTAMP with DATE, TIME, DATETIME, UTC, time zones, and daylight saving time.

Also explained in

Compare how 10 books explain timestamp →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Relational Database Design. The section links point to the parts of the book it draws on.