Our Java application fetches a timestamp (without timezone) type column from the PostgreSQL database. While fetching the data, it converts the time to the local time as expected
All timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the TimeZone configuration parameter before being displayed to the client.
I would like to know if there is a way to get the time as it is stored in the database without the conversion. Usually, we store UTC time in the database, but the client application is developed with PostgreSQL instances configured locally, giving us confusing results while testing.
We can’t modify postgresql.conf
as suggested here. Checking the local timezone and then undoing the zone conversion looks dirty. We can’t use timestamptz
datatype for the column.
We are using mybatis for ORM.
How can I do this properly?