Jump to content


Photo

help with selecting dates and images


  • Please log in to reply
1 reply to this topic

#1 conetix

conetix
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 October 2006 - 07:53 AM

ok i got it printing the date

<?php
$path = "./images";


       if (is_dir("$path") )
       {
           $handle=opendir($path);
           while (false!==($file = readdir($handle))) {
               if ($file != "." && $file != "..") {
                   $Diff = (time() - filectime("$path/$file"))/60/60/24;
                   if ($Diff > 7)
            //echo "$file <br>";
            echo "$file was last modified: " . date ("F d Y H:i:s.", filectime("$path/$file"))."<br>";
            //echo "$Diff <br>";

               }
           }
           closedir($handle);
       }
?>

but i dont think its working right. with the number 7 in their it should only print the images modified in the last 7 days, if i change the number to 14 then it will print in the last 14 days etc....

but its not doing that

243868_card_id_26.jpg was last modified: September 09 2006 22:43:34.
61159_card_id_30.jpg was last modified: September 09 2006 22:43:38.
356149_card_id_27.jpg was last modified: September 09 2006 22:43:42.
100520_card_id_23.jpg was last modified: September 09 2006 22:51:12.
382636_card_id_33.jpg was last modified: September 09 2006 22:43:51.
153207_card_id_25.jpg was last modified: September 09 2006 22:43:55.
415297_card_id_19.jpg was last modified: September 09 2006 22:44:00.
425185_card_id_20.jpg was last modified: September 09 2006 22:44:02.
464095_card_id_35.jpg was last modified: September 09 2006 22:44:06.
601476_card_id_17.jpg was last modified: September 09 2006 22:44:13.
641573_card_id_34.jpg was last modified: September 09 2006 22:44:18.
844266_card_id_22.jpg was last modified: September 09 2006 22:44:21.
902558_card_id_32.jpg was last modified: September 09 2006 22:44:26.
934821_card_id_24.jpg was last modified: September 09 2006 22:44:30.
957743_card_id_36.jpg was last modified: September 09 2006 22:44:33.
988866_card_id_21.jpg was last modified: September 09 2006 22:44:36.
22170_card_id_28.jpg was last modified: September 09 2006 22:44:40.
965166_card_id_39.jpg was last modified: September 10 2006 15:11:36.
897724_card_id_37.jpg was last modified: September 09 2006 22:50:27.
471958_card_id_40.jpg was last modified: September 10 2006 15:22:46.
552300_card_id_38.jpg was last modified: September 10 2006 15:39:51.
700147_card_id_41.jpg was last modified: September 10 2006 15:37:11.
443069_card_id_43.jpg was last modified: September 10 2006 16:09:00.
531626_card_id_42.jpg was last modified: September 10 2006 16:02:01.
550115_card_id_44.jpg was last modified: September 10 2006 16:15:05.
270326_card_id_46.jpg was last modified: September 10 2006 16:45:26.
831731_card_id_45.jpg was last modified: September 10 2006 16:20:29.
316141_card_id_47.jpg was last modified: September 10 2006 16:47:42.
46488_card_id_50.jpg was last modified: September 25 2006 15:49:20.
97586_card_id_49.jpg was last modified: September 25 2006 15:45:09.
427852_card_id_48.jpg was last modified: September 25 2006 15:36:25.
620620_card_id_51.jpg was last modified: September 25 2006 15:52:26

cheers aron

#2 ponsho

ponsho
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 04 October 2006 - 08:20 AM

Try this

<?php
$path = "./images";


       if (is_dir("$path") )
       {
           $handle=opendir($path);
           while (false!==($file = readdir($handle))) {
               if ($file != "." && $file != "..") {
                   $Diff = (time() - filectime("$path/$file"))/(3600*24);
                   if ($Diff < 7)
                   echo "$file was last modified: " . date ("F d Y H:i:s.", filectime("$path/$file"))."<br>";
               }
           }
           closedir($handle);
       }
?> 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users