I'm seeking clarification regarding the usage of timestamp without time zone
in a database and its corresponding Java type, LocalDateTime
. The current setup I'm working on involves servers and (PostgreSQL) databases running exclusively in UTC.
I've encountered numerous recommendations suggesting the use of timestamp with time zone
in the database paired with OffsetDateTime
in Java. However, I fail to see the necessity for this change in our scenario, given the following considerations:
- Both the servers and the database operate in UTC
- When user-agents submit date/time data, it is either already converted to UTC or accompanied by the offset from UTC
- If submitted with an offset, the data is converted to UTC before storage (on the server-side), and eventually the offset information is discarded
- All data is returned to user-agents in UTC, leaving them responsible for converting it to their respective time zones
While I grasp the utility of OffsetDateTime
, in our case I don't see any practical usages or the need to store any time zone information other than UTC in the database.
Could someone provide insight into whether this approach is sound, and if not, why timestamp with time zone
and OffsetDateTime
might be preferable despite our system's UTC-centric nature?