koolaid Posted February 17, 2010 Share Posted February 17, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/192382-get-a-documents-last-modified-date-as-integer/ Share on other sites More sharing options...
jl5501 Posted February 17, 2010 Share Posted February 17, 2010 if you have a date in a string format then strtotime() will probably help you, or the 'U' format specifier to date() Quote Link to comment https://forums.phpfreaks.com/topic/192382-get-a-documents-last-modified-date-as-integer/#findComment-1013716 Share on other sites More sharing options...
PFMaBiSmAd Posted February 17, 2010 Share Posted February 17, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/192382-get-a-documents-last-modified-date-as-integer/#findComment-1013718 Share on other sites More sharing options...
koolaid Posted February 17, 2010 Author Share Posted February 17, 2010 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)); Quote Link to comment https://forums.phpfreaks.com/topic/192382-get-a-documents-last-modified-date-as-integer/#findComment-1013723 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.