strtotime的错误转换和1345810203的date()转换

I want to store start time & end time and calculate the total time difference between the two times.Some time i got negative times like -1 min -24 sec by this problem...

if i am echo this code

date('Y-m-d h:m:s',1345810203);

i got the answer as 2012-08-24 02:08:03 ,but i echo this code

strtotime('2012-08-24 02:08:03');

i got the answer as 1345766883 .

If the time will be 1345810167 or 1345810187,give correct time in strtotime & date().

What is the problem ?

You have wrong format.

m is Numeric representation of a month, with leading zeros

i is Minutes with leading zeros

Use following format:

'Y-m-d h:i:s'

Ref: http://php.net/manual/en/function.date.php