When changing a file's datetimestamp from the current system time to the distant past is there a limit with the time() parameter? With touch(), all the documentation I can see uses the time() parameter which has a future limitation of 100000 seconds:
<?php
$file_pointer = "gfg.txt";
// setting touch time to 5 hours in the past
$time = time() - 18000;
// using touch() function to change the modification
// time of a file to current system time
if (touch($file_pointer, $time))
{
echo ("$file_pointer modification time has been changed to 5 hours in the past.");
}
else
{
echo ("$file_pointer modification time cannot be changed.");
}
?>
What would be the best approach to change it to 1 year in the past or even 5 years in the past? Would the following be the most accepted approach and would it work?:
$time = time() - 31536000;// 1 year
$time = time() - 157680000;// 5 years
CodePudding user response:
use this docs
$time = strtotime("5 years ago");
// or
$time = strtotime("-5 years")