“Fecha de verificación php” Código de respuesta

Php verifique si la entrada es la fecha

function isRealDate($date) { 
    if (false === strtotime($date)) { 
        return false;
    } 
    list($year, $month, $day) = explode('-', $date); 
    return checkdate($month, $day, $year);
}
Wild Weevil

Compruebe si la fecha es pasada PHP

$date = new DateTime($event['date']);
$now = new DateTime();
if($date < $now) {
    echo 'Date is in the past';
}
VasteMonde

Fecha de verificación php

function validateDate($date, $format = 'Y-m-d')
{
    $d = DateTime::createFromFormat($format, $date);
    // The Y ( 4 digits year ) returns TRUE for any integer with any number of digits so changing the comparison from == to === fixes the issue.
    return $d && $d->format($format) === $date;
}
Crazy Crossbill

Respuestas similares a “Fecha de verificación php”

Preguntas similares a “Fecha de verificación php”

Más respuestas relacionadas con “Fecha de verificación php” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código