How to modify a file date and time to current date and time in PHP

1 Answer

0 votes
$filename = 'd:\\data.txt';

if (touch($filename)) 
    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:06/18/2015 12:15:51

*/ 

 



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

Related questions

1 answer 330 views
330 views asked Jun 18, 2015 by avibootz
1 answer 386 views
1 answer 343 views
343 views asked Jun 19, 2015 by avibootz
1 answer 316 views
1 answer 1,289 views
1,289 views asked Jun 19, 2015 by avibootz
2 answers 397 views
...