Skip to content

Instantly share code, notes, and snippets.

@MadaraUchiha
Created June 16, 2012 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadaraUchiha/2942405 to your computer and use it in GitHub Desktop.
Save MadaraUchiha/2942405 to your computer and use it in GitHub Desktop.
Using DateTime looks better than procedural
<?php
$start_time = new DateTime("02/11/2011 00:00:00");
$stop_time = new DateTime("02/11/2011 00:00:00");
$stop_time->modify("+2 days");
$diff = $stop_time->diff($start_time);
echo "Timespan: " . $diff->format('%d days');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment