Calculated field in workflow - add leading zeros


I want to create custom Numbers which will be a combination of text, date and an ID.

In order to do that, I created a new field in a form and a workflow which will fill in the value.

The “number” should be something like that:


XX- = Text
1709 = actual year and month
0039 = an integer to which should always be shown in a 4 digit format. In order to do that I would like to add leading zeros but I have not found out how.

The first part of the number is working with the following formula:


During my research I found the function str_pad but I can’t get it to work in the formula.

Does anybody have an idea how I can do this?