4 ms·
The server's timezone is not even relevant. By using timestamptz, you include the timezone together with the timestamp, meaning you can be absolutely sure that
by misterio7 3y ago
The server's timezone is not even relevant. By using timestamptz, you include the timezone together with the timestamp, meaning you can be absolutely sure that the time stored is indeed UTC! You avoid the mistake of mixing up local times and UTC and forgetting to convert them.
- thermin 3y agothe server timezone is absolutely relevant, it comes into play when a timestamp value is being read from a timestampz column.
- mrrubberburner 3y agoAfaik Databases(as opposed to server) have a default timezone setting, but that is only used if the client hasn’t provided one.
- foverzar 3y agoDo people actually "timestamp" in local time? This seems counterintuitive, aren't timestamps essentially number of seconds passed since 1 jan 1970 00:00 utc?
- m_0x 3y agoYes, people will do anything if their systems and tools allow them to do it, either by ignorance or to facilitate them their current task. Both create tech debt and timestamp tech debt is one that is hard to pay.
- paulryanrogers 3y agoA naive CRUD may accept local times to make things easier for users, not realizing the DB needs UTC. Juniors often commit this error unless told ahead of time. Then you may have weeks or months of data that is wrong and possibly values from many zones.