Answers for "check if date time past day php"

PHP
0

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
0

how to check the day of any date in php

// how to check the day of any date in php?

//Our YYYY-MM-DD date string.
$date = $request->start_date;

//Convert the date string into a unix timestamp.
$unixTimestamp = strtotime($date);

//Get the day of the week using PHP's date function.
$dayOfWeek = date("l", $unixTimestamp);

//Print out the day that our date fell on.
$day = $date . ' fell on a ' . $dayOfWeek;
Posted by: Guest on March-05-2021

Browse Popular Code Answers by Language