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 236 views
236 views asked Jun 18, 2015 by avibootz
1 answer 280 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
2 answers 256 views
...