How to get the date and time of a file in PHP

2 Answers

0 votes
$filename = 'd:\\data.txt';
if (file_exists($filename)) 
    echo "$filename date and time is: " . date("F d Y H:i:s", filemtime($filename));
  
/*
run:

d:\data.txt date and time is: June 17 2015 13:12:29

*/  

 



answered Jun 17, 2015 by avibootz
0 votes
$filename = 'd:\\data.txt';
if (file_exists($filename)) 
    echo "$filename date and time is: " . date("m/d/Y H:i:s", filemtime($filename));
  
/*
run:

d:\data.txt date and time is: 06/17/2015 13:12:29

*/ 

 



answered Jun 17, 2015 by avibootz

Related questions

1 answer 234 views
234 views asked Jun 18, 2015 by avibootz
1 answer 296 views
1 answer 236 views
3 answers 232 views
1 answer 174 views
1 answer 139 views
...