# Time Zone in `TiDB`

__*zz-BGL*__

+ Time zone is relevant to `TiDB` data types (e.g. **`TIMESTAMP`**) and features (e.g. `TiCDC`) 
+ Set global time zone: **`SET GLOBAL time_zone = {timezone}`**
+ Set session time zone: **`SET time_zone = {timezone}`**
+ To verify global, session and system time zone settings, for example:
  + **`@@global.time_zone`**, **`@@session.time_zone`**, **`@@global.system_time_zone`**

![`smart`](ModifyingTimeZone_aa_001_20220627.png)

-----------------------------------------------------------------------
The time zone in `TiDB` is decided by the global `time_zone` system variable and the session `time_zone` system variable. The default value of `time_zone` is `SYSTEM`. The actual time zone corresponding to `SYSTEM` is configured when the `TiDB` cluster bootstrap is initialized. The detailed logic is as follows:
- Prioritize the use of the `TZ` environment variable.
- If the `TZ` environment variable fails, extract the time zone from the actual soft link address of `/etc/localtime`.
- If both of the above methods fail, use `UTC` as the system time zone.

