date/time page was last edited

Permalink
I thought I had this snippet of code working to return the date / time the page was last edited, but it is returning the date and time the last time any page was edited. How do I make this return the date of a specific page.?

[code]
<?php

Loader::model('page_statistics');
echo date('F j, Y', strtotime(pageStatistics::getSiteLastEdit()));

?>

thanks

pvernaglia
 
agedman replied on at Permalink Reply
agedman
I think it's
$page = Page::getCurrentPage();
$page->getCollectionDatePublic('F j, Y')


this link may help:http://www.concrete5.org/documentation/developers/pages/overview...
pvernaglia replied on at Permalink Reply
pvernaglia
That's the public date not the modified date. I think you need to grab it from the database, none of the examples in the forums seem to work correctly, Maybe something like this:

<?php
global $c;
$date = Loader::helper("date"); 
$db = Loader::db();
$colID = $c->getCollectionID();
$r = $db->Execute("SELECT * FROM Collections WHERE cID =  $colID ");
$row = $r->FetchRow();
echo $date->getLocalDateTime($row[cDateModified],$mask = 'm-d-Y G:i');
?>
pvernaglia replied on at Permalink Reply
pvernaglia
That doesn't work either.. this does:

// Load Date Helper
$date = Loader::helper("date");
// You may need to define $c 
global $c; 
// Get Blocks in Main area foreach($c->getBlocks('Main') as $b) {
$bDate[$i] = $b->getBlockDateLastModified();
$i ++; 
}   
// Reverse Sort Date Array 
rsort( $bDate );   
//Echo Date and Time Page last Edited 
echo $date->getLocalDateTime($bDate[0],$mask = 'm-d-Y g:i:s');