strtotime()
does not natively recognize the YYYYMMDDHH
format so you should manually append minutes and seconds like this:
if( strtotime($validtime.'0000') < strtotime('now') ) {
echo "display forecast";
}
else{
echo "hide forecast";
}
Please note that the code above will almost always enter the if()
statement because strtotime('now')
produces seconds so something like this will likely be suitable:
if( strtotime($validtime.'0000') < strtotime(date('Y-m-d H:00:00')) ) {