It's not possible to localize the output of the date() function, you need to use the strftime() function.
Saturday 19 May 2012
zaterdag 19 mei 2012
Samstag 19 Mai 2012
samedi 19 mai 2012
lördag 19 maj 2012
lauantai 19 toukokuu 2012
Show source
<?
error_reporting(E_ALL);
$standard = strftime('%A %e %B %Y', time());
//Dutch
setlocale(LC_TIME, 'nl_NL');
$dutch = strftime('%A %e %B %Y', time());
//German:
setlocale(LC_TIME, 'de_DE');
$german = strftime('%A %e %B %Y', time());
//French:
setlocale(LC_TIME, 'fr_FR');
$french = strftime('%A %e %B %Y', time());
//Swedish:
setlocale(LC_TIME, 'swedish');
$swedish = strftime('%A %e %B %Y', time());
//Finnish:
setlocale(LC_TIME, 'fi_FI');
$finnish = strftime('%A %e %B %Y', time());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>PHP's date & time localization</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
window.onload = function()
{
document.getElementById('source').style.display = 'none'
document.getElementById('toggle_source').onclick = function()
{
if (document.getElementById('source').style.display == 'none')
{
this.firstChild.nodeValue = 'Hide source';
document.getElementById('source').style.display = 'block';
}
else
{
this.firstChild.nodeValue = 'Show source';
document.getElementById('source').style.display = 'none';
}
}
}
</script>
<style type="text/css">
body {
font-family: verdana, arial, sans-serif;
font-size: 10pt;
color: #000;
background: #FFF;
}
p#toggle_source {
text-decoration: underline;
color: #00F;
cursor: pointer;
}
</style>
</head>
<body>
<h1>PHP's date & time localization</h1>
<p>It's not possible to localize the output of <a href="http://www.php.net/date">the date() function</a>,
you need to use the <a href="http://www.php.net/strftime">strftime()</a> function.
<ul>
<li><a href="http://www.php.net/setlocale">setlocale()</a></li>
<li><a href="http://www.php.net/strftime">strftime()</a></li>
<li><a href="http://www.faqs.org/rfcs/rfc1766">RFC1766</a></li>
<li><a href="http://www.w3.org/WAI/ER/IG/ert/iso639.htm">ISO639</a></li>
</ul>
<h2>Standard (english)</h2>
<p><?=htmlentities($standard);?></p>
<h2>Dutch</h2>
<p><?=htmlentities($dutch);?></p>
<h2>German</h2>
<p><?=htmlentities($german);?></p>
<h2>French</h2>
<p><?=htmlentities($french);?></p>
<h2>Swedish</h2>
<p><?=htmlentities($swedish);?></p>
<h2>Finnish</h2>
<p><?=htmlentities($finnish);?></p>
<h2>Source</h2>
<p id="toggle_source">Show source</p>
<div id="source">
<?=highlight_file(__FILE__);?>
</div>
</body>
</html>
1