1

I am trying to change the RDS timezone to UTC,
I'm using an SQL Client called DBeaver

I tried the following two commands -

1. Configuration Parameter Name -

SET timezone TO 'UTC';

and

2. Standard SQL Command -

SET TIME ZONE 'UTC';

But the select now(); command still doesn't return the UTC time

I am referring this answer -
postgres default timezone

Tried the following -
enter image description here

echo $PGTZ

enter image description here

2 Answers 2

4
SET TIME ZONE 'UTC';
ALTER DATABASE your_db_name SET timezone TO 'UTC';
Sign up to request clarification or add additional context in comments.

2 Comments

Are you proposing both of those options or just one?
both sql commands are doing the same thing and both of them change the timezone for the session only, not a permanent change
2

Maybe you are using a connection pool, and session settings get cleared when the session returns to the pool.

You could try something like

ALTER ROLE your_user SET timezone = 'UTC';

You must reconnect for this to take effect.

Also, check if the environment variable PGTZ is set in your environment. It will override the database settings.

If all that doesn't do the trick, consider the possibility that the server's time is off.

1 Comment

Perhaps the server's clock is wrong? I added that option to the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.