Jump to content

get a documents last modified date as integer


koolaid

Recommended Posts

Hello. I want an xml document to update every five minutes. I want to check the documents last modified against the the value of time(). but i cant seem to get it formatted properly. What ( string $format , ) do i use to return an integer formatted like the integer returned by time()? Or i am i going about this all wrong?

 

date (" ???string $format??? ", getlastmod($folder.$filename))

 

Thanks in advance guys

A) getlastmod() does not accept a parameter in the function call. Perhaps you meant to use filemtime()?

 

B) Both getlastmod() and filemtime() return a Unix Timestamp.

 

Please make use of the php.net documentation for the function(s) you are trying to use.

Sorry i did look at the manual. This was the example given thats why i was going about it the way i was.

 

$filename = 'somefile.txt';
if (file_exists($filename)) {
    echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
}

 

This worked perfectly thank you guys.

$date1 = date (filemtime($folder.$filename));

 

Archived

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

×
×
  • Create New...

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.