I'm pretty sure Randal meant '%.2f' for that format string. :) Be aware that this rounds so money stuff can be tricky if you're dealing with fractional cents or percentage discounts.

item.price|format('%.2f')

--mark

Randal L. Schwartz wrote:

"Jason" == Jason Lewis <[EMAIL PROTECTED]> writes:


Jason> I have a variable, item.price, which contains the price of a product
Jason> to 4 decimal places. But I need to fix it to 2 decimal places for
Jason> output. should i write a filter to do that or is there some other way
Jason> that I have missed?

Is there any reason that FILTER format('%.4f') won't do that for you?



_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to