You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在ADF表达式中使用utcNow传递下月日期

修改复制数据活动的文件名表达式,追加下月年月

解决方法

直接用addMonths()函数给当前时间加1个月,再格式化提取年月即可,自动处理跨年场景(比如12月会自动跳到下一年1月)。

修正后的完整表达式

@concat(pipeline().parameters.pipelinepath,'testingfile',formatDateTime(addMonths(utcNow(),1),'MM'),formatDateTime(addMonths(utcNow(),1),'yyyy'),'.csv','/$value/')

细节说明

  • addMonths(utcNow(),1):将当前UTC时间向后偏移1个月,完美适配跨年月情况,比如2022年11月调用会得到2022年12月,2022年12月调用会得到2023年1月
  • 保留formatDateTime的MM(两位月份)和yyyy(四位年份)格式,确保文件名格式符合预期
  • 顺便修正了原表达式中.csv''的多余单引号问题,避免语法报错

内容的提问来源于stack exchange,提问作者bigdata techie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 23:45:43