On 21-Jun-01 Ray Hilton wrote:
> How do I go arround getting php to output the time() function in a
> different language? I have tried the setlocale() function to no avail,
> perhaps my system doesn't have the appropriate locale to do this? If
> so, then how do install them on Red Hat 7?
check strftime() ?
(You _will_ need the appropriate LOCALE files in ../share/locale )
<?php
function initlocale($loc='en_US.ISO_8859-1') {
if (! setlocale('LC_TIME', $loc)) {
debug(__FILE__, __LINE__, "Unsupported TIME locale $loc");
exit();
}
list($lang, $charset) = explode('.', $loc);
// map Linux charset -> RFC standard
$charset=strtr($charset, '_', '-');
Header("Content-Language: $lang, en");
Header("Content-Type: text/html; charset=$charset");
}
function formattime($tm='') {
$fmtstr='%A, %B %e %l:%M%p %Z';
if (empty($tm))
$tm=mktime();
$ds=date('Y-m-d-h-i', $tm);
list ($y, $m, $d, $h, $n)=explode('-', $ds);
$datestr=strftime($fmtstr, mktime($h, $n, 0, $m, $d, $y)) ;
return($datestr);
}
initlocale('de_DE.DIS_8859-15');
print formattime);
?>
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]