Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting a date with Mako templates

In my mako template I have:

<p>${item.addDate}</p>

It returns:

2012-12-27 19:50:00

but I would like to get:

27/12/2012 19:50

Have mako any nifty filters, format functions?

like image 664
David Silva Avatar asked Dec 31 '12 11:12

David Silva


1 Answers

According to google, strftime should do the job:

${post.date.strftime('%Y/%m/%d %H:%M')

Also, according to google:

<%! from time import strftime as time %>
It is the ${"%d of %B" | time}
like image 82
Micha Wiedenmann Avatar answered Sep 24 '22 17:09

Micha Wiedenmann