public
Created

Using DateTime looks better than procedural

  • Download Gist
gistfile1.aw
PHP
1 2 3 4 5 6 7 8 9
<?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');

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.