Skip to content
Advertisement

MONTHNAME in Portuguese MYSQL

I´ve got a huge query (In a PHP file) that gives me a monthname from some dates:

Is there a way to insert my language inline with MONTHANAME?

Something like:

I don´t want to write case for eveymonth to transform ‘Dec’ to ‘Dez’ and so on, this will take too long.

Advertisement

Answer

Unfortunately in MySQL this cannot be done dynamically within a query.

From the documentation :

The language used for the month name is controlled by the lc_time_names system variable.

You need a separate SQL command to change the setting :

The value of the lc_time_names persists for the lifetime of the MySQL session.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement