here I am using one date time object is this
$cdate = date('d/m/Y h:i:sa')
and another date time object is this
$udate = date("d/m/Y h:i:sa", strtotime("72 hours"));
for comparing I am using this condition
if($cdate >= $udate)
but problem is this...in this case its only comparing only day not entire date and time.
The strings returned from date()
are only comparable in certain circumstances. You should use DateTime()
whose objects are always comparable:
$cdate = new DateTime();
$udate = new DateTime('+3 days');
if($cdate >= $udate) {
}