Baidu AI Cloud
中国站

百度智能云

Data Warehouse

Time Zone

Palo supports multi time zone settings

There are multiple Variables related with time zone in Palo.

  • system_time_zone : When the server is started, it will be automatically set according to the time zone set by the machine, which cannot be altered after setting.
  • time_zone : The current time zone of the server includes session level time zone and global level time zone.

Specific operations

  1. show variables like '%time_zone%'

    Used to view the current time zone configuration.

  2. SET time_zone = 'Asia/Shanghai'

    Used to set session level time zone, which will be invalid when the connection is disconnected.

  3. SET global time_zone = 'Asia/Shanghai'

    Used to set global level time zone parameter, which will not be invalid when the connection is disconnected.

The effects of time zone

Time zone setting will affect the display and storage of time value sensitive to time zone,

Including the values displayed by time functions such as NOW or CURTIME and the time values in SHOW LOAD and SHOW BACKENDS.

But it will affect neither the values of time type partition column in CREATE TABLE, nor the display of values stored asdate/datetime type.

Functions affected by time zone:

  • FROM_UNIXTIME: Used to return the date and time of the specified time zone through a given UTC timestamp like FROM_UNIXTIME(0), returning to CST time zone: ``1970-01-01 08:00:00.
  • UNIX_TIMESTAMP: Used to return UTC timestamp through a given date and time of a specified time zone, such as CST time zone UNIX_TIMESTAMP('1970-01-01 08:00:00'), returning to 0,
  • CURTIME: Used to return the time in the specified time zone.
  • NOW: Used to return the date and time in the specified time zone.
  • CONVERT_TZ: Used to transfer a date and time from one specified time zone to another.

Restrictions on use

Time zone values can be presented in several formats and are not case sensitive:

  • Strings representing UTC offset, such as' + 10:00 'or' - 6:00 '
  • Standard time zone format, such as "Asia / Shanghai", "America / Los"_ Angeles"
  • Abbreviated time zone formats such as "MET", "CTT" are not supported and not recommended because they are ambiguous in different scenarios.
  • In order to be compatible with Palo of old version of Palo and support CST abbreviated time zone, CST will be internally converted standard Chinese time zone like "Asia/Shanghai".

Time zone format list

Refer to List of tz database time zones to get writing ways of all time zones.

Previous
Variable
Next
Experimental Functions