Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Problema de PHP con formato de fecha y errores extraños

Necesito trabajar en 2 errores.

El primero es la fecha: muestra un formato de fecha muy raro: "Fecha de vuelta: 1637794800". Debe mostrar la fecha que puso + 10 días.

La segunda son las 2 cosas que Visual Studio Code dice que están mal: .length y isNaN

 <html> <head> <title>lapuente_de la pena_blanca_ModuloDWES_TareaEvaluativa02.php</title> </head> <body> <?php if (isset($_GET['enviar'])) { if (isset($_GET['fechaalquiler']) && ($_GET['fechaalquiler']!==null) && ($_GET['fechaalquiler']!=='')) { echo "Fecha de vuelta: ".gmdate(strtotime($_GET['fechaalquiler']."+ 10 days"))."<br/>"; // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX } else {echo "Fecha no introducida <br/>";} if (isset($_GET['dni']) && ($_GET['dni']!==null) && ($_GET['dni']!=='') && substr("TRWAGMYFPDXBNJZSQVHLCKEO", (int)(substr(($_GET['dni']), 0, 8)) % 23, 1)==substr(($_GET['dni']), 8, 1)) { echo "DNI correcto"; } else if (!$_GET['dni']) { echo "DNI no introducido"; } else if ($_GET['dni'].length!==9 || isNaN(substr(($_GET['dni']), 0, 8))) { // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX echo "DNI incorrecto"; } else { echo "DNI incorrecto; la letra correcta sería ".substr("TRWAGMYFPDXBNJZSQVHLCKEO", (int)(substr(($_GET['dni']), 0, 8)) % 23, 1); } } ?> <form name="input" action="<?php echo $_SERVER['PHP_SELF'];?>" method="get"> <label for="Fecha alquiler">Fecha alquiler</label> <input name="fechaalquiler" type="date"> <?php echo "<br/>"?> <label for="DNI">DNI</label> <input name="dni" type="text"> <br /> <input type="submit" value="Enviar" name="enviar"/> </form> </body> </html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

gracias a los comentarios pude resolver las dudas

Para el primer error: date('Ymd H:i:s', strtotime($_GET['fechaalquiler']."+ 10 days"))

Para los segundos errores: strlen($_GET['dni'])!==9 y !is_numeric(substr(($_GET['dni']), 0, 8))

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!