Change Google Cloud SQL CURRENT_TIMESTAMP time zone?

前端 未结 2 1585
谎友^
谎友^ 2021-02-07 22:11

I\'m using CURRENT_TIMESTAMP in Google Cloud SQL and according to Google, it returns the server\'s current time.

Currently, with the time that it returns, i

2条回答
  •  温柔的废话
    2021-02-07 22:25

    Cloud SQL sets the system time as UTC.

    You can set the timezone for an individual session with a statement like:

    SET @@session.time_zone='-07:00';
    

    You can use named (and daylight savings aware) timezones such as "US/Pacific" if you first set up the timezone table by running a system command like:

    mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -h YOUR_INSTANCE_IP -u root -p mysql
    

提交回复
热议问题