Skip to content

Instantly share code, notes, and snippets.

@credmp
Created September 26, 2011 09:04
Show Gist options
  • Save credmp/1241898 to your computer and use it in GitHub Desktop.
Save credmp/1241898 to your computer and use it in GitHub Desktop.
Simple time calculations
<?php
$start = strtotime('10:31');
$end = strtotime('15:23');
echo "Time spent in seconds: " . ($end - $start);
echo " Time spent in minutes: " . (($end - $start) / 60);
echo " Time spent in hours: " . (($end - $start) / (60*60));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment