PDA

View Full Version : Format date in tpl



kortovos
20 Sep 2010, 11:13 PM
Is there a way to format a date in the tpl? I have a store with a attribute 'dueDate' which is a date, but I don't want to display the entire date (date + time + timezone) in the list which uses the store, just the date (day, month, year). Below is an example of the tpl I mean.

tpl : '<tpl for="."><div class="car"><tpl if="carColor"><div class="car_img" style="background-image: url(resources/{carColor}.jpg);"></div></tpl><h1>{licensePlate}</h1><h2>{carDescription}</h2><div class="details"><div class="dueDate">{dueDate}</div><div class="place">{place}</div></div></div></tpl>',

Stuart-SwarmOnline
21 Sep 2010, 1:11 AM
If you use the syntax...



{Date:date("d/m/Y")}


(obviously change the format string you use so its how you want it!)

kortovos
21 Sep 2010, 1:17 AM
Thanks, works like a charm.