To retrieve the date that a file on the local filesystem was last modified you can use the filemtime() function. A modification of the above example would look like the following:
PHP Code:
/* Retrieve the last modification date for your file */
$date1 = filemtime('/path/to/your/file.ext');
if($date1) {
/* set this in seconds to however far back you want to check */
$offset = 86400;
/* time() gives you the current timestamp */
if ($date1 > time() - $offset) {
/* the file has been modified within the past x days so do something */
} else {
/* do something else */
}
} else {
/* Oops, the file was not found */
}
- Marshall
Bookmarks