WordPress contain language files that hold all of the messages and labels to translate into language.To convert text in another language is very easy in WordPress using the and also you can use multiple language translations.
I was developing WordPress application which language was not English and I wanted the date in another language.Specifically a month name and In that I want to localized month name and WordPress inbuilt functions does not support localized date format.
Basic SYNTAX of setlocale
string setlocale ( int $category ,string $locale [,string $... ] )
$locale : it’s for a different possible locale names
Let’s take one example which shows the difference if you switch from US locale (standard) to German locale.
setlocale (LC_ALL, "de_DE"); //Setting the locale to German
Above function may solve your issue with month names returned by the PHP date() function but produces much bigger and sometimes hidden problems.
It creates problems like, it may convert decimal float value into string values that can affect some calculation of site.
Here are the few more articles which you might like
To create multiple date picker using jQuery
Once we set a locale, all the calls to the translator function will return strings according to the set locale value and we can set it with the use of strftime function.
Basic SYNTAX of strftime
string strftime ( string format [,int timestamp] )
$category : format of the date you want
$locale : Here you require to pass timestamp so if you have date pass date with strtotime.
So, Let’s see one example for strftime which display date according to setlocale language
echo strftime( "%h %y",strtotime("2011-12-22")); // Prints ‘Dez 2011’ month is in German
strong>NOTE: The locale information(setlocale) is maintained per process, not per thread so maybe it is not working with your windows OS in the local server. If its not work with the local server, try it with the live server.