How to print dates in different languages in PHP

In multilingual websites developers may need to print the dates in different languages.

Suppose you would like to print the dates in German language then you may do the following:

<?php

setlocale(LC_ALL, ‘de_DE@euro’, ‘de_DE’, ‘deu_deu’);

echo strftime(“%A”,strtotime($date));

?>

That will print Mittwoch,Donnerstag,Montag in german languages .

Leave a Reply

Your email address will not be published. Required fields are marked *

*