View Single Post
Old 11-05-2012, 01:53 PM   PM User | #3
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
Why not just use a DateInterval:
PHP Code:
date_default_timezone_set('UTC');

$dts = new DateTime('05-11-2012 23:15:00');
$dte = new DateTime('06-11-2012 01:15:00');

$di $dte->diff($dtstrue);
print 
$di->format('%H:%I:%S'); 
The object properties can be inspected as well to see what to show. If its <> 0, then its different in some way shape or form, so you can tack on things like years and months systematically this way.
Thanks Fou-Lu,

This was a very simple logic but I was writing all different though of mine which took this all time.....need be more smart & sharp thinker from the next case....

even I have tried above code my self twice but was doing silly mistake make me open this ticket...

Thanks for you help...

Regards,
Nani
nani_nisha06 is offline   Reply With Quote