check whether the the future date is in the same month as current one? I tried…
$Current_Date=time(); // today - 31st July
$Future_Date =mkdate(~1st aug~); // tomorrow - 1st Aug
if(("m",$Future_Date )>date("m",$Current_Date ))
echo date("j",$Current_Date ) . "SAME MONTH!!";
else
echo date("j",$Current_Date ) . date("m",$Current_Date );
But say if $Future_Date~1st July Next year, it still shows “SAME MONTH”.
I’m making kind of a countdown thing which counts how many months left till the $Future_Date. I wanted to display just the date if it’s in the same month, but date with its month if it’s in the next or any later month.
You can use the dateinterval class in PHP for this: http://php.net/manual/en/class.dateinterval.php or you can also compare on year as well: