Daily Archives: June 27, 2022

PHP Tutorial: How to Check Date is Today Date

Use the following code to check a date whether it is today date. $timestamp = “2022-06-27”; $today = new DateTime(“today”); $match_date = DateTime::createFromFormat( “Y-m-d”, $timestamp ); $match_date->setTime( 0, 0, 0 ); $diff = $today->diff( $match_date ); $diffDays = (integer)$diff->format( “%R%a” ); // Extract days count in interval if ($diffDays != 0) { echo “not today”;…