Here's my code I want to get if early or late thank you po
$current_time = strtoupper(date("g:i a "));
$time = strtoupper(date("g:i a ",strtotime($current_time)));
//print_r($time);
$start_time = $request->start_time;
$s_time = str_replace('/', '-', $start_time);
$fstart_time= strtoupper(date('g:i a',strtotime($s_time)));
//print_r($fstart_time);
if ($time > $fstart_time){
print_r('early');
}else{
print_r('late');
}
CodePudding user response:
Update i fix my problemm But thank youu in advance
here's my code
$start_time = $request->start_time;
$s_time = str_replace('/', '-', $start_time);
$fstart_time= strtoupper(date('g:i a',strtotime($s_time)));
print_r($fstart_time);
if (time() >= strtotime($fstart_time)) {
echo "early";
} else{
echo "late";
}
CodePudding user response:
Here is a simple solution for your format
if (strtotime($request->start_time) >= time()) {
print_r('early');
} else {
print_r('late');
}