Answers for "check date date time in php"

PHP
1

php check if input is date

function isRealDate($date) { 
    if (false === strtotime($date)) { 
        return false;
    } 
    list($year, $month, $day) = explode('-', $date); 
    return checkdate($month, $day, $year);
}
Posted by: Guest on November-08-2020
1

check if date is past php

$date = new DateTime($event['date']);
$now = new DateTime();
if($date < $now) {
    echo 'Date is in the past';
}
Posted by: Guest on March-27-2021

Browse Popular Code Answers by Language