Formatos de fechas

This commit is contained in:
2024-03-22 13:07:43 -06:00
parent c7fb3a8830
commit 515731adf8
2 changed files with 25 additions and 15 deletions

View File

@@ -67,6 +67,9 @@ $hora = $hora_ini.":".$min_ini.":00";
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$fecha_nueva = $fecha;
$fecha_clase = $fecha_falta;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
@@ -82,27 +85,30 @@ switch($tipo){
echo intval($dia)." != ".intval($dia_falta);*/ echo intval($dia)." != ".intval($dia_falta);*/
exit(); exit();
} }
$fecha_nueva = date('d/m/Y', strtotime($fecha_new));
$fecha_clase = date('d/m/Y', strtotime($fecha_falta));
break; break;
case 2://Cambio case 2://Cambio
$fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio)); $dia_falta = date('w', strtotime($fecha_cambio));
$fecha_nueva = date('d/m/Y', strtotime($fecha_cambio));
break; break;
case 3://Solicitud de espacio case 3://Solicitud de espacio
$fecha_nueva = $fecha;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_nueva = date('d/m/Y', strtotime($fecha_new));
break; break;
case 4://Cambio permanente case 4://Cambio permanente
$fecha_nueva = $fecha_new;
$fecha_clase = $fecha_cambio;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_nueva = date('d/m/Y', strtotime($fecha_new));
$fecha_clase = date('d/m/Y', strtotime($fecha_cambio));
break; break;
} }

View File

@@ -64,6 +64,9 @@ $hora = $hora_ini.":".$min_ini.":00";
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$fecha_nueva = $fecha;
$fecha_clase = $fecha_falta;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
@@ -79,27 +82,28 @@ switch($tipo){
echo intval($dia)." != ".intval($dia_falta);*/ echo intval($dia)." != ".intval($dia_falta);*/
exit(); exit();
} }
$fecha_nueva = date('d/m/Y', strtotime($fecha_new));
$fecha_clase = date('d/m/Y', strtotime($fecha_falta));
break; break;
case 2://Cambio case 2://Cambio
$fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio)); $dia_falta = date('w', strtotime($fecha_cambio));
$fecha_nueva = date('d/m/Y', strtotime($fecha_cambio));
break; break;
case 3://Solicitud de espacio case 3://Solicitud de espacio
$fecha_nueva = $fecha;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_nueva = date('d/m/Y', strtotime($fecha_new));
break; break;
case 4://Cambio permanente case 4://Cambio permanente
$fecha_nueva = $fecha_new;
$fecha_clase = $fecha_cambio;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_nueva = date('d/m/Y', strtotime($fecha_new));
$fecha_clase = date('d/m/Y', strtotime($fecha_cambio));
break; break;
} }
@@ -164,11 +168,11 @@ switch($tipo){
break; break;
case 4: case 4:
$db_params=[ $db_params=[
"id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, "id"=>$id, ":f_falta"=>$fecha_clase, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula, ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$query = ":id, NULL, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL"; $query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL";
$asunto = "Solicitud - Cambio permanente"; $asunto = "Solicitud - Cambio permanente";
$texto = "<p>Se actualizó una solicitud de asignación de salón permanente.</p>"; $texto = "<p>Se actualizó una solicitud de asignación de salón permanente.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";