Jump to content

Archived

This topic is now archived and is closed to further replies.

conetix

help with selecting dates and images

Recommended Posts

ok i got it printing the date

[code] <?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);
      }
?> [/code]

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

Share this post


Link to post
Share on other sites
Try this

[code]
<?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);
      }
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.