0

I cannot seem to change the language of a date to Finnish. I installed the finnish language pack in my Linux install, restarted Nginx, and am using the following code :

<li><center>
?>Mitätöidä Myöhemmin <?echo date('l jS \of F Y');?></center></li>
        </ul>
        </div>
</div>

What am I doing wrong here?

jisaacs1207
  • 99
  • 3
  • 13
  • Because PHP obeys you. It does what you tell it to, not what you have in mind. You need to specifically tell PHP to display the date in a particular locale. Use [`setlocale()`](http://php.net/setlocale) for that. See [example](http://stackoverflow.com/a/1328060/). – Amal Murali Feb 17 '14 at 15:58
  • From the manual: *To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().* – Álvaro González Feb 17 '14 at 16:00

1 Answers1

1

date() will always output dates in the English language. If you wish to output them to a specific language, you'll need to use strftime() and pass in the necessary format.

You'll also need to tell PHP which language it should use with setlocale():

setlocale(LC_ALL, 'fi_FI');
echo strftime("%A %e %B %Y");
BenM
  • 52,573
  • 26
  • 113
  • 168