Another method is creating a custom field for that,
use this field code in your book.xml form file
<fieldset
addfieldpath="/administrator/components/com_book/models/fields"
>
..
..
<field name="timestamp" type="lastmodified"
label="" description="" />
..
..
</fieldset>
and create a file called, lastmodified.php
in your /administrator/components/com_book/models/fields folder
<?php
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
/**
* Supports an HTML form field
*/
class JFormFieldLastModified extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'lastmodified';
/**
* Method to get the field input lastmodified.
*
*/
protected function getInput()
{
// Initialize variables.
$html = array();
$old_time_updated = $this->value;
if ($old_time_updated) {
$jdate = new JDate($old_time_updated);
$pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2'));
}
$time_updated = date("Y-m-d H:i:s");
$html = '<input type="hidden" name="'.$this->name.'" value="'.$time_updated.'" />';
return $html;
}
}
?>