data["d"] = date("d"); $this->data["m"] = date("m"); $this->data["a"] = date("Y"); $this->data["s"] = date("w"); $this->data["meses"] = array("01"=>"Janeiro","02"=>"Fevereiro","03"=>"Março","04"=>"Abril","05"=>"Maio","06"=>"Junho","07"=>"Julho","08"=>"Agosto","09"=>"Setembro","10"=>"Outubro","11"=>"Novembro","12"=>"Dezembro"); $this->data["semana"] = array("Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"); $this->data["dm"] = array("1"=>"31","3"=>"31","4"=>"30","5"=>"31","6"=>"30","7"=>"31","8"=>"31","9"=>"30","10"=>"31","11"=>"30","12"=>"31"); $this->data["dm"]["2"] = ($this->EhBisexto(date("Y"))) ? 29 : 28; $this->hora["h"] = date("H"); $this->hora["m"] = date("i"); $this->hora["s"] = date("s"); if ((date("H")) >= 0 && (date("H")) < 6) $this->hora["t"] = "madrugada"; elseif ((date("H")) >= 6 && (date("H")) < 13) $this->hora["t"] = "manhã"; elseif ((date("H")) >= 13 && (date("H")) < 18) $this->hora["t"] = "tarde"; elseif ((date("H")) >= 18) $this->hora["t"] = "noite"; } public function EhBisexto($ano){ if (checkdate(2, 29, $ano)) return 1; else return 0; } public function CDIAS($d){ $d = explode("-", $d); if (checkdate($d[1], $d[2], $d[0])) { if ($d[0] == $this->data["a"]){ if ($d[1] == $this->data["m"]) return ($this->data["d"] - $d[2]); else{ $mi = $d[1] + 1; $mf = $this->data["m"] - 1; $total += $this->data["d"]; for ($i=$mi; $i <= $mf; $i++) $total += $this->data["dm"][$i]; $total += ($this->data["dm"][$d[1]] - $d[2]); return $total; } } else{ return 0; } } else return 0; } public function MySQL_DATETIMEToText($data, $char = "/", $mesmod = 2){ $data = explode(" ", $data); $data[0] = explode("-", $data[0]); if ($data[1] != NULL) $horas = " - ".$data[1]; $mes = ($mesmod == 1) ? date("m") : $this->data["meses"][$data[0][1]]; return ($data[0][2].$char.$mes.$char.$data[0][0].$horas); } } ?>