PrepZone Logo
PrepZone
Back to Database

Database · Medium

How do you store dates, timestamps, and time zones correctly?

DatabaseSchema DesignSenior

Answer preview

Store an instant (something that happened) as TIMESTAMPTZ, which PostgreSQL normalizes to UTC in 8 bytes. Store a local wall-clock time (a future appointment, a shop's opening hour) as TIMESTAMP plus a separate IANA time-zone name, and store a plain calendar day such as a birthda…