FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Spanish date functions in php and mysql

 


ptolomeo
I would like to know if there exist spanish versions of date functions in php and mysql.
For example, spanish version of MONTHNAME(date) on mysql would be very useful for me. Also, for example the php function date("F",$timestamp) gives the month name in english. I would like to know if there is a spanish version of this.

Thank you very much for any help on that.
qscomputing
I don't know - but it's not exactly hard to write your own.

Code:
function monthname_es($num) {
if ($num==1) return 'name-of-january';
if ($num==2) return 'name-of-february';
...
return ''; //catch-all in case nothing matches
}
sonam
I don't know are there Spanish version of PHP but I am using one simple script for month in Croatian language. You can just change Croatian month names in Spanish names.
Code:
$n = (date("n")); // month in number
switch($n) {
      case "1": $m = "Siječanj"; break;
      case "2": $m = "Veljača"; break;
      case "3": $m = "Ožujak"; break;
      case "4": $m = "Travanj"; break;
      case "5": $m = "Svibanj"; break;
      case "6": $m = "Lipanj"; break;
      case "7": $m = "Srpanj"; break;
      case "8": $m = "Kolovoz"; break;
      case "9": $m = "Rujan"; break;
      case "10": $m = "Listopad"; break;
      case "11": $m = "Studeni"; break;
      case "12": $m = "Prosinac"; break;
        default: "";
    }
echo $m;

Sonam
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.