how to separate total hours from database field in Laravel

Viewed 41

I want to fill in this hour and minute column whose data is taken from the data field overtime_total_hour.

enter image description here

This is the code I'm using, I don't know how to fill in the values so that the hours and minutes can be called from the overtime table which is from the overtime_total_hour field.

 <div class="form-group">
       <label class="d-block">Lama Lembur</label>
            <input id="hours" onkeypress="return isNumberKey(event);" maxlength="2" type="text" class="form-control" style="width: 25%; display: inline-block" name="overtime_total_hour" value="">
           <span style="margin-left: 10px">Jam</span>
            <input id="minutes" onkeypress="return isNumberKey(event);" maxlength="2" type="text" class="form-control" style="width: 25%; display: inline-block; margin-left: 10px" name="overtime_total_minutes" value="">
            <span style="margin-left: 10px">Menit</span>
 </div>

Field from table overtime

enter image description here

{{dd($overtime->overtime_total_hour)}}

enter image description here

I want to change like this.

enter image description here

1 Answers

Use This

$lembur = explode(".",$overtime->overtime_total_hour);
echo $lembur[0]; //Jam "2"
echo $lembur[1]; //Menit "22"
Related