-
-
Save ryanmerritt/3745827 to your computer and use it in GitHub Desktop.
Complicated Compare date difference (Seconds)
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 | |
function calculateDateDiff($strStart, $strEnd) { | |
$parts = explode(' ', $strStart); | |
$dates = explode('/', $parts[0]); | |
$times = explode(':', $parts[1]); | |
$unix_start = mktime($times[0], $times[1], $times[2], $dates[0], $dates[1], $dates[2]); | |
$parts = explode(' ', $strEnd); | |
$dates = explode('/', $parts[0]); | |
$times = explode(':', $parts[1]); | |
$unix_end = mktime($times[0], $times[1], $times[2], $dates[0], $dates[1], $dates[2]); | |
return ($unix_end - $unix_start); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment