Fecha Personalizada
PHP
Publicado el 17 de Junio del 2020 por Juan Camilo (2 códigos)
1.422 visualizaciones desde el 17 de Junio del 2020
Generación de Fecha con POO. Por ejemplo: Viernes, 17 de Junio de 2020
<?php
class Fecha {
private $dias=array ("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado");
private $meses = array ("", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
private $year_now;
private $month_now;
private $day_now;
private $week_day_now;
private $zona;
private $fechacompleta;
public function getDias() {
return $this->dias;
}
public function getMeses() {
return $this->meses;
}
public function getYear_now() {
return $this->year_now;
}
public function getMonth_now() {
return $this->month_now;
}
public function getDay_now() {
return $this->day_now;
}
public function getWeek_day_now() {
return $this->week_day_now;
}
public function getFechacompleta() {
return $this->fechacompleta;
}
public function getZona() {
return $this->zona;
}
public function fecha(){
$this->zona=date_default_timezone_set('America/Bogota');
$this->year_now = date("Y");
$this->month_now = date("n");
$this->day_now = date("j");
$this->week_day_now = date("w");
$this->fechacompleta = $this->dias[$this->week_day_now] . ", " . $this->day_now . " de " . $this->meses[$this->month_now] . " de " . $this->year_now;
echo $this->fechacompleta;
}
}
?>
No hay comentarios