EDIT #2 (using str_replace)
The position of 00:00:00
doesn't matter in this case, even if the dates have no space between them.
Works on 00:00:00 2003-01-28
and 2003-01-28 00:00:00
and 2003-01-2800:00:00
<?php
$if_date_null = "00:00:00";
$replace = ""; // replace with nothing
// doesn't matter the position of 00:00:00
$dates = "00:00:00 2003-01-28";
// $dates = "2003-01-28 00:00:00";
$result = str_replace($if_date_null,$replace,$dates);
echo $result;
?>
EDIT #1
<?php
$date = "2003-01-28";
$date_null = "00:00:00";
if (strpos($date_null,'00:00:00') !== false) {
echo '00:00:00 found ';
}
else {
echo "No ZEROS found ";
}
?>
Original answer
This will echo 2003-01-28 and not include the space between 2003-01-28 and 00:00:00
<?php
echo substr("2003-01-28 00:00:00",0,-9);
?>
You can also assign date as a variable like this: (will produce the same result) and use that variable elsewhere if needed.
<?php
$date = "2003-01-28";
echo substr("$date 00:00:00",0,-9);
?>