I used this function to find remaining days in PHP
function days_until($date){
return (isset($date)) ? floor((strtotime($date) - time())/60/60/24)+1 : FALSE;
}
It's almost perfect except when it has to return any value greater than 7547
An example case is when I tried to find days_until('2038-01-20')
, today being 2017-05-22, returns -17308
. While the same for days_until('2038-01-19')
returns 7547
. Can anyone tell me whats going on here? Its like strtotime($date)
isn't even working, and returning 0.
Can anyone solve this, with an explanation, please?