Here is my php code.
It is working fine.
<?php ........ $cdt1 = Date("Y-m-d H:i:s"); $last_seen = "2015-05-20 12:15:20"; $datetime22 = new DateTime($cdt1); $datetime11 = new DateTime($last_seen); $interval1 = $datetime11->diff($datetime22); echo $interval1->format('%y years %m months and %d days %H hours, %i min and %s sec '); ......... ?>
It is giving me output like this.
0 years 0 months 0 days 00 hours 1 min and 52 sec. Something like that.
if year is 0 then year doesn't show. if month is 0 then month doesn't show. if days is 0 then days doesn't show. same for hour and min as well.
e.g if difference of time is 1 hour 24 min 30 sec then it should
appear like 1 hour 24 min 30 sec. I don't want year/month/days if they