To get the modified timestamp, just do the following in PHP:
$object->attribute( 'modified' );
This will return a unix timestamp. To format it, just use PHP's date function (and see PHP's manual for all formatting options, it's quite similar to the 'date' command in unix).
Hans, I really appreciate your help. But this doesn't seem to work. When I insert the code you furnished, eZ publish generates an error and cannot finish processing. I tried echoing the statement, but what resulted was:
'Last-Modified: ' . gmdate(modifed)
Instead of 'Last-Modified: ' . Monday, November 10, 2003 4:04:24 PM
It doesn't seem to grab the date to process... Any thoughts?
Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
That's weird. I tested the code on my local install and it works fine.
Of course, $object means the name of the variable that holds your content object.
Just did another test (just printing it in kernel/content/view.php) with the code: gmdate( 'D, d M Y H:i:s', $object->attribute('modified') )
The result of that code (on my content object) is: Mon, 29 Sep 2003 18:43:36
EDIT: I just noticed there's a typo in my post above. It said 'modifed' instead of 'modified'. I should learn to always use copy/paste instead of typing it again ;) Sorry for that.
That did it! I understand the mistake; I've made many like that myself. In fact, I should have caught the typo as well considering how much time I spent studying that one line.
Thanks for your help!
Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
You must be logged in to post messages in this topic!