[Solved] Days remaining before birthday in php [duplicate]


Duplicate Date Difference in php on days?

EDITED:

$diff=$date-time();//time returns current time in seconds
$days=floor($diff/(60*60*24));//seconds/minute*minutes/hour*hours/day)
$hours=round(($diff-$days*60*60*24)/(60*60));

Is this how you wanted?

$birthday = "1977-9-10";
$cur_day = date('Y-m-d');
$cur_time_arr = explode('-',$cur_day);
$birthday_arr = explode('-',$birthday);

$cur_year_b_day = $cur_time_arr[0]."-".$birthday_arr[1]."-".$birthday_arr[2];

if(strtotime($cur_year_b_day) < time())
{
    echo "Birthday already passed this year";
}
else
{
    $diff=strtotime($cur_year_b_day)-time();//time returns current time in seconds
    echo $days=floor($diff/(60*60*24));
}

1

solved Days remaining before birthday in php [duplicate]