Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
PHP problem with date format and strange errors

I need to work on 2 errors.

The first one is the date: it shows a very rare date format: "Fecha de vuelta: 1637794800". It should show the date you put + 10 days.

The second one are the 2 things Visual Studio Code says are wrong: .length and 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 Respuestas
Responde la pregunta

0

Thanks to the comments, I could resolve the questions

For the first error: date('Y-m-d H:i:s', strtotime($_GET['fechaalquiler']."+ 10 days"))

For the second errors: strlen($_GET['dni'])!==9 and !is_numeric(substr(($_GET['dni']), 0, 8))

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda