Thanks for your query and using this forum for raising your concern.
To get the desired output (to write folder name as a number from 1 to 12`) you can use the following dynamic expression:
@concat('directory-path/','y=',formatDateTime(utcnow(),'yyyy'),'/','m=',if(equals(string(startswith(string(formatDateTime(utcnow(), 'MM')), '0')), 'True'), substring(formatDateTime(utcnow(), 'MM'),1,1), formatDateTime(utcnow(), 'MM')),'/','d=',formatDateTime(utcnow(),'dd'))
I have tested this with a set variable activity and is working as expected. Please see below GIF
Here is the pipeline JSON payload, incase if you would like to play around with formatting.
{
"name": "pipelineDateTimeConversion",
"properties": {
"activities": [
{
"name": "setVarMonthStartingZero",
"description": "Convert month numbers from (01-12) to (1-12)",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "varMonth",
"value": {
"value": "@concat('directory-path/','y=',formatDateTime(utcnow(),'yyyy'),'/','m=',if(equals(string(startswith(string(formatDateTime(utcnow(), 'MM')), '0')), 'True'), substring(formatDateTime(utcnow(), 'MM'),1,1), formatDateTime(utcnow(), 'MM')),'/','d=',formatDateTime(utcnow(),'dd'))",
"type": "Expression"
}
}
}
],
"variables": {
"varMonth": {
"type": "String"
}
},
"annotations": []
}
}
I'm reaching out to ADF product team to confirm if this is the expected behavior in ADF or if it is a bug and will get back to you as soon as I have an update.
In the meantime, the above solution should help you to achieve your requirement.
Hope this helps and let us know if you have further query.
----------
Thank you
Please do consider to click on "Accept Answer" and "Upvote" on the post that helps you, as it can be beneficial to other community members.