Tips/LastModifiedDate

Putting a "last modified on/at" line on your site

Pages have a 'mtime' attribute which can be used to get the last modified date/time, like this:

<p>This page was last updated at <%= @item.mtime %>.</p>

which could be compiled to

<p>This page was last modified at Mon Oct 01 15:57:30 +0200 2007.</p>

A nicely-formatted timestamp can be obtained by using the following code:

<%= @item.mtime.strftime("%A %B %d, %Y at %H:%M:%S %Z") %>

which would yield something like:

"Wednesday December 19, 2007 at 02:45:42 CST"