How To Compare Two Dates in Php?

Admin   PHP   441  2021-03-17 22:20:04

Hi Guys,

In this example,I will learn you how to compare two date in can easy and simply compare to date in php.

Given two dates (date1 and date2) and the task is to compare the given dates. Comparing two dates in PHP is simple when both the dates are in the same format but the problem arises when both dates are in a different format.







echo $diff->format("%R%a days");




+244 days

It will help you...