7.6 Common Pitfalls: Storing Timestamps Without Timezone
Right, let’s talk about one of the most common, and most insidious, database design mistakes I see: storing a timestamp without its time zone. You might as well be storing a photograph without the context of who’s in it or when it was taken. You have the data, but its entire meaning is ambiguous. It’s a promise you can’t keep, and it will come back to haunt you. The core of the problem is this: a timestamp without time zone information (timestamp in PostgreSQL, DATETIME in MySQL, datetime in SQLite) is just a vague point on the calendar and clock. It has no inherent meaning. Is it 2023-10-26 14:30 in London? In New York? On the International Space Station? You simply don’t know. The database will happily store whatever string of numbers you give it, blissfully unaware that it’s holding a semantic mess.