[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1603
  • Last Modified:

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
0
ceciliamtz
Asked:
ceciliamtz
  • 4
  • 3
1 Solution
 
gruntarCommented:
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
0
 
ceciliamtzAuthor Commented:
this is the output:

Preferred locale on this system is ''
0
 
gruntarCommented:
hm, not good. Try to add those values...

Spanish
es_ES.ISO8859-1
es_ES.utf-8

Cheers
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gruntarCommented:
This code did the trick on my mychine

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

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

cheers
0
 
ceciliamtzAuthor Commented:
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
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now