how to compare two dates in php?
Method 1: Using strtotime() function. In this way, weâll compare two dates by two steps-. 1  Convert two dates into their respective timestamps. 2  The timestamp of a date, as you know, is number of seconds since January 1 1970 00:00:00 UTC.3  Then, find out the greater date comparing those two timestamps.n this way, weâll compare two dates by two steps-. 1  Convert two dates into their respective timestamps. 2  The timestamp of a date, as you know, is number of seconds since January 1 1970 00:00:00 UTC.