SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Getting the last updated time of the file in PHP

We can get the last updated date of any file by using filemtime function in PHP. This function returns date in UNIX Timestamp format and we can convert it to our requirement by using date function.


This function filemtime() uses the server file system so it works for local systems only, we can't use this function to get the modified time of any remote file system.


Here is the code to get the last modified date of any file. We are checking for a existing file ( test.php)

echo date("m/d/Y",filemtime(“test.php”));


The above code will display the modified date in month/day/year format.
Note that we have used date function to convert the Unix Timestamp time returned by filemtime() function.


Further readings
PHP file handling functions
Reading from local and remote files by using fopen()
Writing to a file by fwrite() function
file_exists: Checking if file is present or not
unlink:Deleting file by using unlink function
Deleting all files present inside a directory
Downloading files using header control
File upload to server using PHP
File upload using PHP 5 and register_global off
Uploading More than one file to server
Displaying all files and directory of a folder
Getting the Present file name running the PHP script
pathinfo: getting all the details like dir name, file name , extension etc
Getting the last updated time of the file in PHP
Displaying the last modification time of the file
Searching for text within a pair of tags of a html page
Listing All title tags inside a directory
Creating thumbnail images after uploading the file
















Join Our Email List
Email:  
For Email Newsletters you can trust
File handling
PHP Sections