Re: Mktime formatting problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/11/06, Ryan A <genphp@xxxxxxxxx> wrote:
Hey,

So far this is what I have done:
-----------------------------
1) read the files from a directory, discard the files
with a  .php extention and the directories (eg: . and
.. )

2) put the files into an array ($the_files[])

3) put it into a while loop and display the files like
so:

echo $the_files[$i] . date("F d Y H:i:s.",
filectime($directory_with_files.$the_files[$i]));
-----------------------------


The next step is, I want to only echo the files that
are over x minutes (or x hours) old, ignore anything
below, I am using mktime() along with date() to format
it accordingly...but am unable to do so.



Can someone kindly give me a quick example on how to
do this? sitting too long on the comp, I think i'm
losing it :-(

If you want the php file that i have written please
tell me and will send it to you offlist.

Thanks!
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
-----
Fight back spam! Download the Blue Frog.
http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



One thing you could do:

$old_time = time() - 60*15;

echo "<br>old time: ". $old_time;

foreach (glob("*.php") as $filename) {
   echo "<br>file ({$filename}) time ". filectime($filename);
  ///echo "<br>$filename size " . filesize($filename) . "\n";

  if (filectime($filename) <= $old_time) {
       echo "--showing: ". $filename;
  }
}

Filectime is just a unix timestamp as is time().  So just subtract the
number of seconds you want to show and compare on that.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux