...

View Full Version : How to get the difference between two datetime values



Mido™
09-12-2009, 05:08 PM
I want to get the difference between two datetime values and I don't know how,I tried to do this by making this simple way:
$difTime = $currTime - $logTime;

but it result "0",so I hope if there is a way to do it right.

kbluhm
09-12-2009, 05:21 PM
Assuming datetime means they are formatted as `Y-m-d H:i:s`:


$difTime = strtotime( $currTime ) - strtotime( $logTime );

Mido™
09-12-2009, 06:47 PM
they formatted as `Y-m-d h:i:s`.
and thanks for help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum