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