How to modify a file date and time in PHP

1 Answer

0 votes
$filename = 'd:\\data.txt';
 
if (touch($filename, mktime(0, 0, 0, 12, 31, 1999)))
     echo "$filename modified to current date & time:".date("m/d/Y H:i:s", filemtime($filename));
else
    echo "Error <br />";

/*
run:

d:\data.txt modified to current date & time:12/31/1999 00:00:00

*/  

 



answered Jun 18, 2015 by avibootz
edited Jun 18, 2015 by avibootz

Related questions

1 answer 297 views
1 answer 238 views
238 views asked Jun 19, 2015 by avibootz
1 answer 213 views
1 answer 1,187 views
1,187 views asked Jun 19, 2015 by avibootz
1 answer 280 views
2 answers 256 views
...