10.16 MySQL Server Locale Support

The locale indicated by the lc_time_names system variable controls the language used to display day and month names and abbreviations. This variable affects the output from the DATE_FORMAT(), DAYNAME(), and MONTHNAME() functions.

lc_time_names does not affect the STR_TO_DATE() or GET_FORMAT() function.

The lc_time_names value does not affect the result from FORMAT(), but this function takes an optional third parameter that enables a locale to be specified to be used for the result number's decimal point, thousands separator, and grouping between separators. Permissible locale values are the same as the legal values for the lc_time_names system variable.

Locale names have language and region subtags listed by IANA (http://www.iana.org/assignments/language-subtag-registry) such as 'ja_JP' or 'pt_BR'. The default value is 'en_US' regardless of your system's locale setting, but you can set the value at server startup, or set the GLOBAL value at runtime if you have privileges sufficient to set global system variables; see Section 5.1.9.1, “System Variable Privileges”. Any client can examine the value of lc_time_names or set its SESSION value to affect the locale for its own connection.

mysql> SET NAMES 'utf8';
Query OK, 0 rows affected (0.09 sec)

mysql> SELECT @@lc_time_names;
+-----------------+
| @@lc_time_names |
+-----------------+
| en_US           |
+-----------------+
1 row in set (0.00 sec)

mysql> SELECT DAYNAME('2010-01-01'), MONTHNAME('2010-01-01');
+-----------------------+-------------------------+
| DAYNAME('2010-01-01') | MONTHNAME('2010-01-01') |
+-----------------------+-------------------------+
| Friday                | January                 |
+-----------------------+-------------------------+
1 row in set (0.00 sec)

mysql> SELECT DATE_FORMAT('2010-01-01','%W %a %M %b');
+-----------------------------------------+
| DATE_FORMAT('2010-01-01','%W %a %M %b') |
+-----------------------------------------+
| Friday Fri January Jan                  |
+-----------------------------------------+
1 row in set (0.00 sec)

mysql> SET lc_time_names = 'es_MX';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@lc_time_names;
+-----------------+
| @@lc_time_names |
+-----------------+
| es_MX           |
+-----------------+
1 row in set (0.00 sec)

mysql> SELECT DAYNAME('2010-01-01'), MONTHNAME('2010-01-01');
+-----------------------+-------------------------+
| DAYNAME('2010-01-01') | MONTHNAME('2010-01-01') |
+-----------------------+-------------------------+
| viernes               | enero                   |
+-----------------------+-------------------------+
1 row in set (0.00 sec)

mysql> SELECT DATE_FORMAT('2010-01-01','%W %a %M %b');
+-----------------------------------------+
| DATE_FORMAT('2010-01-01','%W %a %M %b') |
+-----------------------------------------+
| viernes vie enero ene                   |
+-----------------------------------------+
1 row in set (0.00 sec)

The day or month name for each of the affected functions is converted from utf8 to the character set indicated by the character_set_connection system variable.

lc_time_names may be set to any of the following locale values. The set of locales supported by MySQL may differ from those supported by your operating system.

Locale ValueMeaning
ar_AEArabic - United Arab Emirates
ar_BHArabic - Bahrain
ar_DZArabic - Algeria
ar_EGArabic - Egypt
ar_INArabic - India
ar_IQArabic - Iraq
ar_JOArabic - Jordan
ar_KWArabic - Kuwait
ar_LBArabic - Lebanon
ar_LYArabic - Libya
ar_MAArabic - Morocco
ar_OMArabic - Oman
ar_QAArabic - Qatar
ar_SAArabic - Saudi Arabia
ar_SDArabic - Sudan
ar_SYArabic - Syria
ar_TNArabic - Tunisia
ar_YEArabic - Yemen
be_BYBelarusian - Belarus
bg_BGBulgarian - Bulgaria
ca_ESCatalan - Spain
cs_CZCzech - Czech Republic
da_DKDanish - Denmark
de_ATGerman - Austria
de_BEGerman - Belgium
de_CHGerman - Switzerland
de_DEGerman - Germany
de_LUGerman - Luxembourg
el_GRGreek - Greece
en_AUEnglish - Australia
en_CAEnglish - Canada
en_GBEnglish - United Kingdom
en_INEnglish - India
en_NZEnglish - New Zealand
en_PHEnglish - Philippines
en_USEnglish - United States
en_ZAEnglish - South Africa
en_ZWEnglish - Zimbabwe
es_ARSpanish - Argentina
es_BOSpanish - Bolivia
es_CLSpanish - Chile
es_COSpanish - Colombia
es_CRSpanish - Costa Rica
es_DOSpanish - Dominican Republic
es_ECSpanish - Ecuador
es_ESSpanish - Spain
es_GTSpanish - Guatemala
es_HNSpanish - Honduras
es_MXSpanish - Mexico
es_NISpanish - Nicaragua
es_PASpanish - Panama
es_PESpanish - Peru
es_PRSpanish - Puerto Rico
es_PYSpanish - Paraguay
es_SVSpanish - El Salvador
es_USSpanish - United States
es_UYSpanish - Uruguay
es_VESpanish - Venezuela
et_EEEstonian - Estonia
eu_ESBasque - Spain
fi_FIFinnish - Finland
fo_FOFaroese - Faroe Islands
fr_BEFrench - Belgium
fr_CAFrench - Canada
fr_CHFrench - Switzerland
fr_FRFrench - France
fr_LUFrench - Luxembourg
gl_ESGalician - Spain
gu_INGujarati - India
he_ILHebrew - Israel
hi_INHindi - India
hr_HRCroatian - Croatia
hu_HUHungarian - Hungary
id_IDIndonesian - Indonesia
is_ISIcelandic - Iceland
it_CHItalian - Switzerland
it_ITItalian - Italy
ja_JPJapanese - Japan
ko_KRKorean - Republic of Korea
lt_LTLithuanian - Lithuania
lv_LVLatvian - Latvia
mk_MKMacedonian - North Macedonia
mn_MNMongolia - Mongolian
ms_MYMalay - Malaysia
nb_NONorwegian(Bokmål) - Norway
nl_BEDutch - Belgium
nl_NLDutch - The Netherlands
no_NONorwegian - Norway
pl_PLPolish - Poland
pt_BRPortugese - Brazil
pt_PTPortugese - Portugal
rm_CHRomansh - Switzerland
ro_RORomanian - Romania
ru_RURussian - Russia
ru_UARussian - Ukraine
sk_SKSlovak - Slovakia
sl_SISlovenian - Slovenia
sq_ALAlbanian - Albania
sr_RSSerbian - Serbia
sv_FISwedish - Finland
sv_SESwedish - Sweden
ta_INTamil - India
te_INTelugu - India
th_THThai - Thailand
tr_TRTurkish - Turkey
uk_UAUkrainian - Ukraine
ur_PKUrdu - Pakistan
vi_VNVietnamese - Vietnam
zh_CNChinese - China
zh_HKChinese - Hong Kong
zh_TWChinese - Taiwan