Not a developer? Go to MovableType.com

Documentation

sprintf

A general purpose formatter based on the sprintf command found in a number of programming languages. The value of the attribute should be the format string. The tag value will be passed in as the argument to sprintf.

Examples

Format the entry count with parentheses and pad with zeros to 6 digits:

<$mt:EntryCommentCount sprintf="(%.6d)"$>

Result for an entry with 23 comments:

(000023)

Format the month number with a proceeding 0 if number is a single digit:

<$mt:Var name="month_number" value="2"$>
<$mt:Var name="month_number" sprintf="%02d"$>

Output for month “2” (February):

02

Convert the value of TagName into a floating point number with a precision of 2:

<$mt:TagName sprintf="%.2f"$>
Back