How to change the default timezone in Amazon Redshift

redshift

Setting a timestamp column to SYSDATE by default, stores it as UTC. Is it possible to change the timezone so SYSDATE stores dates and times to a different timezone?

So far, I've checked the SET command but I'm not sure if it is possible to use it to change the timezone.

Best Answer

You can change the timezone with a SET command.
For example:

SET TIMEZONE = 'America/Los_Angeles';

For more info please find the relevant AWS documentation here.

The challenge is that setting the environment seems to hold for maybe the leader node but doesn't get transferred along to the compute node that may end up writing your table. See the comments here for more info on the issue:

Until the folks at Amazon fix that issue, you can alter the user timezone with

ALTER USER dbuser SET timezone to 'America/Los_Angeles';

or convert the timezone each time you make the timestamp like so:

load_dttm TIMESTAMP DEFAULT convert_timezone('America/Los_Angeles', sysdate) NOT NULL