I would like to compare the two dates ,one date is which the 02 aug 1921 , and the second date is present date.How to compare the old date and present date day and month .if the past date 02 sept and present date 02 sept equals it should echo. I had the script which compares the past and present date with the year.How to compare without the year.?
$r1=$row['dateofcon'];
//dateofcon was 02 aug 1921.
echo $r1; ?>
$cmg1 = strtotime("$r1");
$day1=date('l',$cmg1);
$now1 = time();
$timeleft1 = $cmg1-$now1;
$daysleft1 = round((($timeleft1/24)/60)/60); //probably...
if($daysleft1 == 0) {
echo "Happy Conday";}
Probably the most straight forward way is strtotime and date.
$date1 = '1 Aug 2012';
$date2 = '1 Aug 1912';
if (date('m-d', strtotime($date1)) === date('m-d', strtotime($date2)) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With