Link to home
Start Free TrialLog in
Avatar of ceciliamtz
ceciliamtzFlag for Mexico

asked on

Trouble with setlocale("LC_TIME", "es_ES");

Hi

I need to show a date field in my data base in spanish. I have ste the code

<?php
setlocale(LC_TIME, 'es_ES');
?>

on my page.

The code to show the date field is:

<?php echo strftime("%A, %e %b %Y", strtotime($row_tb_dates['fecha'])); ?>

I get  Wednesday, 22 Dec 2004 instead of Miércoles, 22 de Dic 2004

Am I missing something?

Thanks

Cecilia
Avatar of gruntar
gruntar

Try this to see what will work on your server...

   $loc_es = setlocale (LC_ALL, 'es_ES', 'es');
   echo "Preferred locale on this system is '$loc_es'";

cheers
Avatar of ceciliamtz

ASKER

this is the output:

Preferred locale on this system is ''
ASKER CERTIFIED SOLUTION
Avatar of gruntar
gruntar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This code did the trick on my mychine

setlocale(LC_TIME,'Spanish');
none of the values worked for me
could it be something at the server? maybe some modification to php.ini?
Try this one
setlocale(LC_TIME,'Spanish_Spain');

or read official documentation http://si.php.net/manual/en/function.setlocale.php

cheers
got it working with

setlocale(LC_TIME, 'es_ES.ISO8859-1');

I don't know why the previous time it didn't work

Thanks a lot!!

Cecilia