Note
- This variable is available starting with V4.3.1 in the V4.3.x series.
- This variable is available starting with V4.2.2 in the V4.2.x series.
Description
lc_time_names specifies the language for displaying date and month names and abbreviations.
Applicability
This variable applies only to OceanBase Database in MySQL mode.
Privilege requirements
Query variables
Global level
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to view the values of global system variables.Session level
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theinformation_schema.SESSION_VARIABLESview (MySQL mode) to view the values of session system variables.
Modify variables
Global level
systenants can directly modify the values of global system variables.MySQL user tenants must have the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables.
Session level
systenants and all user tenants can directly modify the values of session system variables.
Attributes
| Attribute | Description |
|---|---|
| Type | Varchar |
| Default value | en_US |
| Value range |
|
| Scope |
|
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Usage
This variable affects the output of the DATE_FORMAT(), DAYNAME(), and MONTHNAME() functions, but does not affect the results of the STR_TO_DATE() or GET_FORMAT() functions.
Examples
For example, display the result of a date function in Chinese:
Set the language for displaying date and month names and abbreviations to Chinese.
Session level
obclient> SET lc_time_names='zh_CN';Global level
obclient> SET GLOBAL lc_time_names='zh_CN';
View the current value of
lc_time_names.obclient> show variables like "lc_time_names";The returned result is as follows:
+---------------+-------+ | Variable_name | Value | +---------------+-------+ | lc_time_names | zh_CN | +---------------+-------+ 1 row in set (0.015 sec)Query the name of the day corresponding to the input date by using the
DAYNAME()function.obclient> select DAYNAME('2023-01-06');The returned result is as follows:
+-----------------------+ | DAYNAME('2023-01-06') | +-----------------------+ | Friday | +-----------------------+ 1 row in set (0.000 sec)
