Dear PHP'er,
I've written this tutorial because many people do not know how they echo a time in their own language. This is actually very simple and I also tell you how to do this.
How does it work?
To change the language to dutch you just have this piece of code placed on your script to convert. This ensures that the language changed in Dutch:
[php]<?php
setlocale(LC_ALL, 'nl_NL');
?>[/php]
Below is an example how you can use:
[php]<?php
echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));
# Output without setlocale() : Friday 22 December 1978
# Output with setlocale(LC_ALL, 'nl_NL'): vrijdag 22 december 1978
# Output with setlocale(LC_ALL, 'de_DE'): Freitag 22 Dezember 1978
# Output with setlocale(LC_ALL, 'fr_FR'): vendredi 22 décembre 1978
?>[/php]
Warning! This does not work on every server.
This script does not work on a Windows server.
For a Windows server, you need the following language string:
[php]<?php
setlocale(LC_ALL, 'nld_NLD');
?>[/php]
If you have a Windows server and you want to select a different language.
Can you find the language strings in the following link:
Language strings
I hope you learned something from this tutorial!
Yearupie