Если вас интересует только год-месяц-день, мое предложение будет что-то вроде:
// As per comments, the second param in the date function MUST be a UNIX timestamp, so strtotime will resolve this
$dateInDB = date("Y-m-d", strtotime($DateInDatabase)); // format to XXXX-XX-XX
$dateToCheck = date("Y-m-d", strtotime($DateSpecific)); // format to XXXX-XX-XX
if ($dateInDb == $dateToCheck)
{
// They are the same
}
else
{
// The are different
}
Как уже говорили другие, вы также можете использовать прямое сравнение строк;
$DateInDatabase = "2018-05-08 15:54:40";
$DateSpecific = "2018-05-08";
// This function uses the params haystack, needle in that order
if (stristr($DateInDatabase, $DateSpecific))
{
// Match found
}
else
{
// No match found
}