Return the Language used for Date & Time Functions in MariaDB

MariaDB has a lc_time_names system variable that controls the language used by the DAYNAME(), MONTHNAME() and DATE_FORMAT() date and time functions.

Here’s how to return the value of that variable.

Select the lc_time_names Variable

You can use the following command to return the value of the lc_time_names variable:

SELECT @@lc_time_names;

Result:

+-----------------+
| @@lc_time_names |
+-----------------+
| en_US           |
+-----------------+

In my case, the result is en_US, which is actually the default (regardless of the system’s settings).

Change the lc_time_names Variable

You can use the following command to change the value of the lc_time_names variable:

SET lc_time_names = 'es_CR';

Now let’s select the variable again:

SELECT @@lc_time_names;

Result:

+-----------------+
| @@lc_time_names |
+-----------------+
| es_CR           |
+-----------------+

We can see that it has been changed to the specified locale.

List of Locales

See Date & Time Locales Available in MariaDB for a full list of locales supported by MariaDB.

You can also return a list of supported locales with a query. See How to Show all Locales in MariaDB for instructions on doing this.