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 336 views
336 views asked Jun 18, 2015 by avibootz
1 answer 391 views
1 answer 189 views
1 answer 366 views
3 answers 389 views
1 answer 265 views
1 answer 218 views
...