Boards.ie uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Click here to find out more x
Post Reply  
 
Thread Tools Search this Thread
05-01-2002, 14:24   #1
Pablo
Registered User
 
Join Date: Apr 2001
Location: cork & munich germany
Posts: 464
date stamp called from php

there has to be a nice way to call the date.

as in on the site i want it to have last edited on .... Nov 3rd 2002 {anyother reasonable format would do tho} ... and it could be that last time that that file {or another file was updated}
Pablo is offline  
Advertisement
05-01-2002, 15:21   #2
dahamsta
Banned
 
Join Date: Oct 2000
Location: The Internet
Posts: 16,324
RTFM

adam
dahamsta is offline  
Thanks from:
05-01-2002, 15:41   #3
Pablo
Registered User
 
Join Date: Apr 2001
Location: cork & munich germany
Posts: 464
merci beacoups
Pablo is offline  
05-01-2002, 21:15   #4
dahamsta
Banned
 
Join Date: Oct 2000
Location: The Internet
Posts: 16,324
Couldn't find this earlier:

PHP Code:
<?
echo date('y.m.d.H.i.s'filemtime($DOCUMENT_ROOT $PHP_SELF));
?>
That'll print:
Code:
YY.MM.DD.HH.MM.SS
adam
dahamsta is offline  
Thanks from:
12-02-2002, 17:43   #5
Pablo
Registered User
 
Join Date: Apr 2001
Location: cork & munich germany
Posts: 464
Warning: stat failed for (errno=2 - No such file or directory)

is an error i'm getting , it saying line 9 is the problem one



for the code

PHP Code:
<?
// last update

$newFile="";                                 // init newFile

$handle=opendir('.');                        // open dir
while (false!==($file readdir($handle))) { // read all files in dir
    
if ($file != "." && $file != "..") {     //only if file is not . or ..
        
$fileDate filemtime($file);        // get date from file
        
$newDate  filemtime($newFile);     // get date from newFile
        
if ($newDate $fileDate) {          // if file is newer
           
$newFile $file;                 // replace newFile with newerfile
        
}
    }
}
closedir($handle);                           // close file

$newDate  filemtime($newFile);             // get date from newFile
$fileModDate date("d/m/Y",$newDate);       // convert date
Print("$fileModDate");              // print date

?>
Pablo is offline  
Advertisement
12-02-2002, 18:07   #6
dahamsta
Banned
 
Join Date: Oct 2000
Location: The Internet
Posts: 16,324
/* comments inline */


PHP Code:
<?
// last update

/* You've initialised $newFile to an empty string here, right? */

$newFile="";                                 // init newFile

$handle=opendir('.');                        // open dir
while (false!==($file readdir($handle))) { // read all files in dir
    
if ($file != "." && $file != "..") {     //only if file is not . or ..
        
$fileDate filemtime($file);        // get date from file

        /*  But here you're trying to stat the file.
            How can you stat an empty string?    */

        
$newDate  filemtime($newFile);     // get date from newFile
        
if ($newDate $fileDate) {          // if file is newer
           
$newFile $file;                 // replace newFile with newerfile
        
}
    }
}
closedir($handle);                           // close file

$newDate  filemtime($newFile);             // get date from newFile
$fileModDate date("d/m/Y",$newDate);       // convert date
Print("$fileModDate");              // print date

?>
dahamsta is offline  
Thanks from:
Post Reply

Quick Reply
Message:
Remove Text Formatting
Bold
Italic
Underline

Insert Image
Wrap [QUOTE] tags around selected text
 
Decrease Size
Increase Size
Please sign up or log in to join the discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search