note 92325 deleted from function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Mon, 20 Jul 2009 03:16:13 +0000 |
| Subject: | note 92325 deleted from function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158489@lists.php.net to get a copy of this message | ||
Note Submitter: BioPhp
----
Needed a simple way to determine if a file was less than a certain number of days old (11 in this
example). The following is my solution:
$f //the name of the file
if((strtotime(date("Y-m-d",strtotime("now"))) -
strtotime(date("Y-m-d",filemtime($f))))/(60*60*24) < 11){
//do something if it's less than 11 days old
}else{
//do something else if it's 11 days or older
}
Hope this is helpful.
Cheers