Set 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 set the value of that variable.

Set 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 = 'da_DK';

That’s all. The variable has been set.

In this case I set it to da_DK but you can use any locale supported by MariaDB.

Check the Result

Now let’s check the value of the lc_time_names variable:

SELECT @@lc_time_names;

Result:

+-----------------+
| @@lc_time_names |
+-----------------+
| da_DK           |
+-----------------+

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.