I want write a code that give me next occurrence of hour from current time.
E.g Give closest next 8:00 am.
Scenario 1 :
Input :
$currentTime = '11-26-2020 20:00'; // MM-DD-YYYY H:i
Expected Output :
$closest8am = '11-27-2020 8:00';
Scenario 2 :
Input :
$currentTime = '11-27-2020 01:00'; // MM-DD-YYYY H:i
Expected Output :
$closest8am = '11-27-2020 8:00';
Thank You in advance.