[ZPT] Modification Time

Evan Simpson evan@zope.com
Mon, 17 Dec 2001 10:32:49 -0500


Sam Collett wrote:

> I want to be able to change the format of the following into UK format
> (DD/MM/YY HH:MM).
> 
> Last Modified: <b
> tal:content="string:${template/bobobase_modification_time}"></b>
> 
> I know how to do it in dtml, but how to you do it with page templates?


Date formatting is peformed internally with the "strftime" method of 
DateTime objects.  You can use it explicitly, like so:

tal:content="python:template.bobobase_modification_time.strftime('%d/%m/%Y')"

Note that writing "string:${a/b}" is equivalent to, but less efficient 
than, plain "a/b".

Cheers,


Evan @ Zope