2 ms·
And your last sentence is exactly what many people want. Let's say I'm writing a calendar application. Naturally, the user wants to enter all events in their o
by crote 8y ago
And your last sentence is exactly what many people want.
Let's say I'm writing a calendar application. Naturally, the user wants to enter all events in their own timezone, which in my case is Europe/Amsterdam. So I can just convert that to UTC, and store it along with a timezone string? Well, that's going to break horribly when the EU abolishes summer time next year, because all of those UTC stamps will be wrong!
The only sane option here is to store local time, and a string representing the timezone, which is what the name "timestamp with timezone" suggests it is. Yes, I could do the conversion manually, but it would be a lot more convenient to have it in the database directly.
- welder 8y agoYes, you're right. Scheduling is one reason to store timestamps with timezone, to prevent information loss.
- zeroimpl 8y agoThis is exactly why I said in my original post that I sometimes want this - in many cases I don't, but whenever a user has explicitly input the data I'd like to easily be able to return it in the same timezone. I can (and do) store two columns in the database, but I'd prefer the database and JDBC interface natively support this as a single data type. Right now, supposing you have two columns, EventTime TIMESTAMPTZ and EventTimeZone TEXT, you'd have to do something like the following in your query to get the data returned to the application properly: SELECT (EventTime AT TIME ZONE EventTimeZone) || ' ' || EventTimeZone