Skip to content

Instantly share code, notes, and snippets.

@turtlix
Created May 13, 2016 00:55
Show Gist options
  • Save turtlix/a0c6af816fcb431d5208dff5f397e10b to your computer and use it in GitHub Desktop.
Save turtlix/a0c6af816fcb431d5208dff5f397e10b to your computer and use it in GitHub Desktop.
<?php
function dateDiff($date1, $date2){
$datetime1 = new DateTime($date1);
$datetime2 = new DateTime($date2);
$interval = $datetime1->diff($datetime2);
return $interval->format('%H:%I');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment