Forums / Developer / formatting number

formatting number

Author Message

Mike Makris

Friday 08 October 2010 8:07:43 am

How do I format a number so that there is a leading zero if I have only one digit? (to be used for the day number in a date dropdown)

MikeM

Lo' F.

Saturday 09 October 2010 6:57:43 am

What about something like this?

<select>
  {for 1 to 31 as $num}
  {if $num|lt(10)}
    <option>{concat('0', $num)}</option>  
  {else}    
    <option>{$num}</option>  
  {/if}
{/for}
</select>

loredanaebook.it

Mike Makris

Tuesday 12 October 2010 6:08:39 am

Thank you. I was actually trying to avoid this. I thought there might be a string formating function which I'm sure I'll need for output.

MikeM