datetime - Why do I get 31 Dec 1969 as my last modified filename using filemtime in php? -
I'm a newbie to php and so please do not pay attention to asking me this question but why exactly filemtime (filename .txt)
gives me its last revised time as 31 December, 196?
- because it does not exist
- or because it is not in the correct directory
- or because you did not quote its name - you did not ^^
The date of January 1, 1970 is the date of "zero";
So, December 31, 1969 is the date / time of zero ... according to your location, I think; I myself, with this code:
$ filemtime = filemtime (filename.txt); $ Formated = date ('y-m-d h: i: s', $ filemtime); Var_dump ($ filemtime, $ formated);
Obtain this output:
Boolean false string '1 971-01-01 01:00:00' (length = 19)
false because the file does not exist, and 1970-01-01
at 01:00
due to my location (I I am in France, UTC + 1 hour)
And note that I also get some notices and warnings:
-
NOTICE: Use Undefined Continuous Filename - Assumed 'Filename'
-
Notice: Undefined Use of TextType - Assumed 'txt'
-
Warning: Filemtime () [function.filemtime]: failed for stat filenametxt
< / Ul>
Do you have any of these?
If not, then is error_reporting
and / or display_errors
enabled?
Comments
Post a Comment