Created
May 18, 2020 04:55
-
-
Save heyitsnovi/2fb3493fd30cc72f4edb4f62d31b06d0 to your computer and use it in GitHub Desktop.
Example of subtracting 2 times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hourly_rate = 2.5; | |
$startTime = new DateTime("2020-05-14 08:00:00"); | |
$endTime = new DateTime("2020-05-14 17:00:00"); | |
$duration = $startTime->diff($endTime); //$duration is a DateInterval object | |
$worked_hours = (int)$duration->format("%H"); | |
echo $worked_hours * 2.5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment