Home > Back-end >  Why does PostgreSQL convert a timestamp that has an UTC offset to UTC format, although the column ty
Why does PostgreSQL convert a timestamp that has an UTC offset to UTC format, although the column ty

Time:12-14

I use PostgreSQL in Docker, and I also have installed PostgreSQL on my Mac. In Docker it converts timestamp with timezone to UTC, but in the installed PostgreSQL it saves the time zone offset.

I enter the value 2021-03-25 01:08:25 02, but it converts to UTC:

startDate
2021-03-24 23:08:25 00

I enter the same value (2021-03-25 01:08:25 02) into the program:

t2
2021-03-25 01:08:25 02

CodePudding user response:

The value of the timezone parameter is different in both session. PostgreSQL always displays timestamp with time zone according to the current setting of timezone, so you should set that correctly for each database session.

  • Related