Re: [PHP] Re: date() funtion language

2004-02-13 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
ohhh
thanks hehe
Don Read wrote:
On 12-Feb-2004 André Cerqueira wrote:

-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


snip

//the follow should, but doesnt seem to work
//setlocale(LC_ALL, 'pt_BR');
//echo date('l, j de F de Y');
?


date() doesn't format according to locale but strftime() does:

setlocale(LC_ALL, 'pt_BR.ISO8859-1');
echo strftime('%A, %B %e %Y');
// output 'Quinta Feira, Fevereiro 12 2004'



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFALQ4vaxdA/5C8vH8RAullAKDRwh4XpJg/lbZymdgW2fI+C2XbHwCfT5E+
6kGxyTlAnBjWvZGy1XT5YSY=
=mYsa
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: date() funtion language

2004-02-13 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
hmz...
i just tryed that... didnt work
tryed other locale strings, didnt work...
do i need something else to make it work?
running php4.3.4rc3 on windows


Don Read wrote:

On 12-Feb-2004 André Cerqueira wrote:

-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


snip

//the follow should, but doesnt seem to work
//setlocale(LC_ALL, 'pt_BR');
//echo date('l, j de F de Y');
?


date() doesn't format according to locale but strftime() does:

setlocale(LC_ALL, 'pt_BR.ISO8859-1');
echo strftime('%A, %B %e %Y');
// output 'Quinta Feira, Fevereiro 12 2004'



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFALQ73axdA/5C8vH8RAt+IAKCuAH1hlInsMdcwkNvFmJy119YC/ACg0uws
uvW3FtqgRSXl5VkOcPVgTls=
=3cMI
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: date() funtion language

2004-02-12 Thread Don Read

On 12-Feb-2004 André Cerqueira wrote:
 -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
 

snip

 
 //the follow should, but doesnt seem to work
 //setlocale(LC_ALL, 'pt_BR');
 //echo date('l, j de F de Y');
 ?

date() doesn't format according to locale but strftime() does:

setlocale(LC_ALL, 'pt_BR.ISO8859-1');
echo strftime('%A, %B %e %Y');

// output 'Quinta Feira, Fevereiro 12 2004'



-- 
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, visit: http://www.php.net/unsub.php



[PHP] Re: date() funtion language

2004-02-11 Thread André Cerqueira
-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