[ad_1]
i hope all of you doing well.
i am using the following function to find the opening and closing time for a store.
function timeBetween($sunrise, $sunset)
date_default_timezone_set("Asia/Karachi");
$current_time = date('h:i a');
$date1 = DateTime::createFromFormat('H:i a', $current_time);
$date2 = DateTime::createFromFormat('H:i a', $sunrise);
$date3 = DateTime::createFromFormat('H:i a', $sunset);
if ($date1 >= $date2 && $date1 < $date3)
return TRUE;
else
return FALSE;
it is working fine but problem came when user select time from two different dates like 9am to 2am if the format remain same like 1 am to 11pm it works fine.
Note : i am just asking for the opening and closing time not any date.
Can somebody help me how to achieve that ?
Thanks in advance.
[ad_2]
لینک منبع