Does PHP timestamp difference calculation return milliseconds, seconds or minutes?

StackOverflow https://stackoverflow.com/questions/22179414

  •  05-06-2023
  •  | 
  •  

質問

firstly let me say sorry for the rather 'simple' question. I have been doing a lot of search and I can't find any satisfactory answer.

Assuming I have two timestamps like this

$current_time = time();
$old_time = 1393955449;

then I do something like this

$diff_time = $current_time - $old_time;

it gives me something like say 500 My question now is, this 500 given as the result is it milliseconds or seconds or minutes.

Sorry again if this is too basic for all those 'PHP Gurus'

役に立ちましたか?

解決

It's in seconds according to the docs: http://www.php.net/time

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

他のヒント

For any query regarding time you can visit the following links. Hope this might help you.

https://www.php.net/manual/en/datetime.diff.php
https://www.php.net/time
https://www.w3schools.com/php/php_ref_date.asp
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top