PHP date()返回时间错误[关闭]

When using PHP to do time() and store it in a MySQL server and then retrieve it, when I try to convert it into seconds, it returns strange results.

1386787112 = 35 seconds ago (What my PHP says)

1386787112 was actually 1 second ago (What my current time says).

$da = date("s",1386787112);

This code is meant to returns the current time in second but it only updates if the time is bigger than 60 seconds. Am I doing something wrong?

Using the time() function will do what you're looking for. It's in fact defined just like your requirements.

Now, if you wanted seconds ago you could then use the time() function to do that:

$secs = time() - dbTimeValOfRecord;