note 31176 deleted from function.date by didou

From: Date: Mon, 06 Oct 2003 15:35:20 +0000
Subject: note 31176 deleted from function.date by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57897@lists.php.net to get a copy of this message
Note Submitter: barao_d_submundo(a)portugalmail.pt ---- I'm a beginer but i'm still making my way through php with a great help from the coments left in the site, so I would like to contribute with my share this time with this simple code that allows anyone to translate to their language a simple phrase like: "Domingo, 25 de Dezembro de 2003" (Sunday, 25th December of 2003) This script is made for portuguese but can be easily generalized to any other language. <? //This is an array with the 7 days of the week $semana= array("Domingo","Segunda-feira","Terça-feira","Quarta-feira", "Quinta-feira","Sexta-feira","Sábado"); //This makes an array with the 12 months of the year //Mind that the first collumn is in blank to just because //the format in php to represent months numerically is from 1 to 12, so //the $meses[0] is in blank //and will never be used. $meses=array(" ","Janeiro","Fevereiro","Março","Abril","Maio", "Junho","Julho","Agosto","Setembro", "Outubro","Novembro","Dezembro"); //Day of the month $dia_mes=date("j"); //Day of the week $dia_semana=date("w"); //Month of the year $mes_ano=date("n"); //The year :P $ano=date("Y"); //and finally it's echo echo $semana[$dia_semana].', '.$dia_mes.' de '.$meses[$mes_ano].' de '.$ano; ?> I hope this can be usefull to other newbies, since i bet that most advanced users might know some other shorter way of doing it, but much more complicated.

« previous php.notes (#57897) next »