Time zone

    • BE: Backend, Doris’s back-end node. Responsible for query execution and data storage.

    There are multiple time zone related parameters in Doris

    • :

    When the server starts, it will be set automatically according to the time zone set by the machine, which cannot be modified after setting.

    • time_zone:

    Server current time zone, set it at session level or global level.

    1. SHOW VARIABLES LIKE '% time_zone%'

      View the current time zone related configuration

    2. SET time_zone = 'Asia/Shanghai'

      This command can set the session level time zone, which will fail after disconnection.

    3. This command can set time zone parameters at the global level. The FE will persist the parameters and will not fail when the connection is disconnected.

    Time zone setting affects the display and storage of time zone sensitive values.

    It includes the values displayed by time functions such as NOW() or CURTIME(), as well as the time values in and SHOW BACKENDS statements.

    However, it does not affect the LESS THAN VALUE of the time-type partition column in the CREATE TABLE statement, nor does it affect the display of values stored as DATE/DATETIME type.

    Functions affected by time zone:

    • UNIX_TIMESTAMP: Given a specified time zone date and time, return UTC timestamp, such as CST time zone UNIX_TIMESTAMP('1970-01 08:00:00'), return 0.

    • NOW: Returns the specified date and time of specified time zone.

    • CONVERT_TZ: Converts a date and time from one specified time zone to another.

    Time zone values can be given in several formats, case-insensitive:

    • A string representing UTC offset, such as ‘+10:00’ or ‘-6:00’.

    • Standard time zone formats, such as “Asia/Shanghai”, “America/Los_Angeles”

    • In order to be compatible with Doris and support CST abbreviated time zone, CST will be internally transferred to “Asia/Shanghai”, which is Chinese standard time zone.

    Edit on GitHub (opens new window)