How to list file with time stamp?

Discussion in 'PHP' started by aayybb, Jun 17, 2009.

  1. #1
    I would like to list files in a directory with correct time and date the files were created. But the following code gave me time stamp of December 31 1969 19:00:00 when the files are recently created. How do I get the right time and date?

    $dir = opendir("temp_dir");
    while (($file = readdir($dir)) !== false)
    {

    $ftime = date("F d Y H:i:s.",filemtime($file));
    echo $file.' '. $ftime;

    }

    Thanks in advance.
     
    aayybb, Jun 17, 2009 IP
  2. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I figured it out myself. Sorry. I need to include the file path to make it work.
     
    aayybb, Jun 17, 2009 IP