This php script explain you , how you can calculates the difference of time between them in years, months, days.
<?php
/* 
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
$date_1 = "2007-03-24";
$date_2 = "2013-06-01";
$diff = abs(strtotime($date_2) - strtotime($date_1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
printf("%d years, %d months, %d days\n", $years, $months, $days);
?>
 





 
 
 
 


0 comments:
Post a Comment