-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
i had problems with locale i think its safer to make a dayname and monthname array, and use getdate(), than build the string yourself
like:
<? $wdayname_array = array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'); $monthname_array = array('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro');
function date_wrapper($format, $timestamp=NULL) { global $wdayname_array, $monthname_array;
if ($timestamp == NULL) $timestamp = time();
$date = getdate($timestamp); $wdayname = $wdayname_array[$date['wday']]; $monthname = $monthname_array[$date['mon']-1];
$format = str_replace(array('l', 'F'), array('\\\\\l', '\\\\\F'), $format); $date = date($format, $timestamp); $date = str_replace(array('\\l', '\\F'), array($wdayname, $monthname), $date);
return $date; }
echo date_wrapper('l, d \de F \de Y');
//the follow should, but doesnt seem to work //setlocale(LC_ALL, 'pt_BR'); //echo date('l, j de F de Y'); ?>
this example may not work well with slashes... just wrote it hehe
tb sou brasileiro hehe (im brazillian too)
Thiago Pavesi wrote:
| Hello, | | Does any one knows how do I set my date() function to return the days | of the week and moth in my own language (brazilian portuguese)? | | Thanks, | | Thiago Pavesi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAKuWmaxdA/5C8vH8RAv7gAJ0WHvXC4beywQDTjQzz7KI0jLGfPACgjqgv y/UzSg9ijyRx/UvWGi8dFXU= =Wh2S -----END PGP SIGNATURE-----
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php