how can i get time in the page?

Permalink 1 user found helpful
I want to display time in the page. There is any option in dashboard other than write in php code.
how can i display publish date/last edit date etc for blocks.
If any one knows please give me reply

chakri
 
pvernaglia replied on at Permalink Best Answer Reply
pvernaglia
You'd need to put a little PHP into your theme page to display the date with the date helper:

<?php
  $date = Loader::helper("date");
  echo $date->getLocalDateTime('now',$mask = 'd-m-Y')
?>


date the page was added/created

<?php echo $c->getCollectionDateAdded('d-m-Y') ?>


date a page was last edited

// 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 = 'd-m-Y');


you can fid a lot helpful code snippets here:

http://www.weblicating.com/c5/cheat-sheet/...
chakri replied on at Permalink Reply
chakri
Thank you pvernaglia,Providing best answer for me.
Please send sample path where can i place these php code.Thank you