更新时间:2023-01-31 18:15:39
addMonths
and addYears
are not supported by ADF so far.Please vote up this thread to push the progress.
我的技巧是使用 ADF中的内置功能.请查看我的测试:
My trick is use combination of bulit-in functions in ADF. Please see my test:
这个月很简单:
@concat(substring('07/16/2019',6,4),substring('07/16/2019',0,2))
输出:
上个月比较复杂,应该检查是否是一年的第一个月.
Last month is little complex.It should check if it is the first month of the year.
@if(equals(substring('07/16/2019',0,2),'01'),
concat(
string(sub(
int(substring('07/16/2019',6,4)),1)),
'12'),
string(sub(
int(concat(substring('07/16/2019',6,4),
substring('07/16/2019',0,2))),1)
)
)
如果输入参数为01/16/2019,则输出看起来像:
if the input param is 01/16/2019,then the output looks like:
我的测试基于静态值,请用您的变量替换它.
My test is based on the static value,please replace it with your variable.
仅作总结:
最终的动态工作内容应如下所示:
The final working dynamic content should be like as below:
@if( equals(variables('SubstringMonth'),'01'),
concat(string(sub(int(variables('SubstringYear')),1)),'12'),
concat(variables('SubstringYear'),string(if(or(equals(sub(int(variables('SubstringMonth')),1),11),equals(sub(int(variables('SubstringMonth')),1),10)),
sub(int(variables('SubstringMonth')),1) ,
concat('0',string(sub(int(variables('SubstringMonth')),1) )))) ))