Created
December 27, 2020 11:10
-
-
Save AucT/c2289cb82be8eccc3c66d7fd729dabb8 to your computer and use it in GitHub Desktop.
Convert php Interval (ISO8601) to seconds function, Convert php Interval (ISO8601) to minutes function
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 ISO8601ToSeconds($ISO8601){ | |
$interval = new \DateInterval($ISO8601); | |
return ($interval->d * 24 * 60 * 60) + | |
($interval->h * 60 * 60) + | |
($interval->i * 60) + | |
$interval->s; | |
} | |
function ISO8601ToMinutes($ISO8601){ | |
$interval = new \DateInterval($ISO8601); | |
return ($interval->d * 24 * 60) + | |
($interval->h * 60) + | |
($interval->i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment