I have been using the folowing script for some years and it works perfectly in English but I now need to use this script on a German website and would like to know if there is a way of changing the language the browser displays so that the date portion is in German or French or whatever?
[fphp]setlocale[/fphp] returns false if it cannot set the locale (possibly because the system doesn’t have that locale installed), try the following which works this end.
<?php
error_reporting(-1);
ini_set('display_errors', true);
ini_set('date.timezone', 'Africa/Johannesburg');
if( ! setlocale(LC_TIME, 'de_DE')){
echo 'Cannot set new locale';
exit;
}
echo strftime('%A %e %B %Y');
/*
Donnerstag 5 Januar 2012
*/
I need to be able to have the current date show in English and French on a multi-lingual website. It must display in the format - Monday, 14 March 2012.