Reputation: 4008
I have: $worked_hrs_today = 07:18
$worked_hrs_today = $usr_stamp_in->diff($usr_stamp_out);
I have: $shift_break = 00:30:00
$shift_break = $shift_data['break'];
07:18
is a DateTime obj, or maby it's called interval?
00:30:00
is a string.
How can i convert 00:30:00
to a interval, so that i can sub that time from 07:18
?
What i wan't is to calculate: 07:18 - 00:30 = 06:48
Should i use: new DateTime();
Upvotes: 0
Views: 101
Reputation: 108
if its a DateTime obj. just use strtotime()
Like this:
$shift_break = strtotime($shift_break);
$newTime = $worked_hrs_today - $shift_break;
Upvotes: 1