filemtime — Gets file modification time
This function returns the time when the data blocks of a file were being written to, that is, the time when the content of the file was changed.
My question: is filemtime returning:
EDIT: probably the definition of "timestamp" is same as time() (This count starts at the Unix Epoch on January 1st, 1970 at UTC)
The filemtime function returns a timestamp, which is to say it returns the number of seconds since the Unix Epoch. Timezones are inconsequential to timestamps; Midnight 1/1/1970 UTC happened simultaneously everywhere, afterall. Timezones represent an offset to be applied to this amount of seconds in order to reach the relative time for the region.
In other words, if you look at the integral value of a timestamp, change your timezone, and look at it again, it'll still be the same number. The difference comes when you use a function like date() to format that number to a timezone-relative date/time. See this comment on the usage of time().
The filemtime function returns a Unix time stamp, which is UTC. This is per definition, since Unix timestamps represent the amount of seconds expired since Midnight 1/1/1970 UTC.
time() similarly is a Unix timestamp, so
filemtime values can be compared directly to it without any timezone considerations.
(I provided this additional answer because when I arrived here by Google, I found the other one a bit hard to understand - I hope someone else will find the brevity helpful)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With