I try to first find out the date of the file creation and then compare it with the current date. Make a condition if the file was created no later than 2 weeks, then:

So far he has written the definition of the date of file creation, but for some reason it always displays the same thing, although there should be different dates. output example: 01.01.1970 03:00:00

 echo date("dmY H:i:s.", filemtime($out_1)); 

Tell me how to properly find out the date and compare with the current?

    1 answer 1

    It is possible so:

      $filetime = filectime("test.txt"); $time = microtime(true); $endtime = $time - $filetime; echo "Файл был создан $endtime секунд назад."; 

    filemtime - Returns the time the file was last modified