Can I force a number of digits on a number?


#1

Is it possible to force a number to have a number of digits?

Example force "8" to render as "08"

I'm trying to use this because I want to render a specific date format after having added/subtracted a number of days. Note that I'm not talking about the CURRENT date/time. I want to specify the starting date/

e.g. I specify a start date of 08/15/19 (MM/DD/YY) and I want to subtract 6 days. If I just use a regular equation, it will return 08/9/19. But I want it to return 08/09/19, because that's the format I need to paste into the specific field I want to fill.


#2

You can use the format attribute for the equation command to do this:

No Padding:
{=4+5}
Pad number with 0's to a length of two:
{=4+5; format=02}
Pad number with 0's to a length of three:
{=4+5; format=03}

Another example:
{=4+7}
{=4+7; format=02}
{=4+7; format=03}

More examples are available here:


#3

Neat! Thanks :slight_smile: