<?
/* By Thales A. Santos
DarK ThaleS
http://darkthales.hcerto.com
hide@address.com
*/
Class dataExtenso {
var $data;
var $expl;
var $retornos;
var $mes;
function extenDia($dia){
switch ($dia){
case 1: $this->retornos = "primeiro"; break;
case 2: $this->retornos = "segundo"; break;
case 3: $this->retornos = "terceiro"; break;
case 4: $this->retornos = "quarto"; break;
case 5: $this->retornos = "quinto"; break;
case 6: $this->retornos = "sexto"; break;
case 7: $this->retornos = "sétimo"; break;
case 8: $this->retornos = "oitavo"; break;
case 9: $this->retornos = "nono"; break;
case 10: $this->retornos = "décimo"; break;
case 20: $this->retornos = "vigésimo"; break;
case 30: $this->retornos = "trigésimo"; break;
}
return $this->retornos;
}
function dia($dia){
if(($dia - 30) > 0){
$this->retornos = $this->extenDia(30)." ".$this->extenDia($dia - 30);
} elseif(($dia - 20) > 0){
$this->retornos = $this->extenDia(20)." ".$this->extenDia($dia - 20);
} elseif(($dia - 10) > 0){
$this->retornos = $this->extenDia(10)." ".$this->extenDia($dia - 10);
} else {
$this->retornos = $this->extenDia($dia);
}
return $this->retornos;
}
function mes($mes){
$this->mes = array('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro');
$this->retornos = $this->mes[$mes];
return $this->retornos;
}
function dataExtenso($data){
$this->expl = explode("/", $data);
$this->retornos = $this->dia($this->expl[0]);
$this->retornos = "Hoje é o ".$this->retornos." dia do mês de ".$this->mes($this->expl[1])." do ano de ".$this->expl[2];
echo ucfirst($this->retornos);
}
}
?>