Display Expire time in Days, Hours, Minutes and Seconds



<?php
date_default_timezone_set('Asia/Calcutta');
function datediff( $date1, $date2 )
{
$diff = abs( strtotime( $date1 ) - strtotime( $date2 ) );

return sprintf
(
"%d Days, %d Hours, %d Mins, %d Seconds",
intval( $diff / 86400 ),
intval( ( $diff % 86400 ) / 3600),
intval( ( $diff / 60 ) % 60 ),
intval( $diff % 60 )
);
}

print datediff( "2015-05-11 14:55:00", "now" ) . "\n";