Page 1 of 1

help needed with setlocale and strftime question

Posted: Tue Jun 21, 2005 4:09 pm
by sofasurfer
hello!

1st of all, let me thank everyone for helping me out.


my question:

my MySQL database has a datefield, that I need to output on the format Month Year (in Portuguese, for instance, May 2005).

my code



PHP:

Code: Select all

setlocale(LC_ALL, 'pt_PT.ISO8859-1', 'pt_PT.utf-8', 'portuguese', 'pt_PT');
and on the echo statement:

PHP:

Code: Select all

echo strftime($row_rsListaProvas['date_m']); ?><?php echo strftime($row_rsListaProvas['date_y']);

of course, date_m and date_y are alias fields that I create with the query to the database.

I get the result of the query in English...
how can I output it in Portuguese? the
echo strftime($row_rsListaProvas['date_m']);
outputs in english, even with the setlocale ok >> I tested the output of echo strftime('%B'); and outputed ok in Pt.

What I'm I doing wrong?

remeber, when I make the query, the results come on English.. is there a way for me to, besides altering the format of the datefield, to change also the language through the query?

or is there another way, a php way to output for instance Maio 2005 instead of May 2005?

the part of the query that needs :( help:

DATE_FORMAT( 'data' , '%%M' ) AS date_m

What can I do? :(

thx :)

Posted: Tue Jun 21, 2005 4:24 pm
by method_man
DO NOT CROSS POST!!!

Posted: Wed Jun 22, 2005 7:54 am
by timvw
You could select the date as a UNIX_TIMESTAMP...