2

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.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.