note 17095 deleted from control-structures.switch by jimw
| From: | jimw@php.net | Date: | Sat, 15 Dec 2001 22:12:49 +0000 |
| Subject: | note 17095 deleted from control-structures.switch by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22850@lists.php.net to get a copy of this message | ||
for english or american people are no problem for name of month,
but for the italian(as me) or some people that no speak english
this can be a good solution for insert the name of month.
//this is my date
$date="2001-11-26";
//extraction 3 parts of date
$year=substr($date,0,4);
$mounth0=substr($date,5,2);
$day=substr($date,8,2);
//part of switch,
//more IMPORTANT
switch($mounth0){
case 1:
$mounth="Gennaio"; //or january
break;
case 2:
$mounth="Febbraio";
break;
case 3:
$mounth="Marzo";
break;
case 4:
$mounth="Aprile";
break;
case 5:
$mounth="Maggio";
break;
case 6:
$mounth="Giugno";
break;
case 7:
$mounth="Luglio";
break;
case 8:
$mounth="Agosto";
break;
case 9:
$mounth="Settembre";
break;
case 10:
$mounth="Ottobre";
break;
case 11:
$mounth="Novembre";
break;
case 12:
$mounth="Dicembre";
break;
}
echo"$day-$mounth-$year";
in this way we have change date format and
we have get a name at the mounth with italian language.
Probably this isn't a way more fast but this is the more easy ;-)