[英]How to remove milliseconds from utcnow() result in Azure data factory
I want to pass a value for parameter usertime, the value should be like 2020-07-23T13:19:31Z, which will be used in my source connection url.我想为参数 usertime 传递一个值,该值应该类似于 2020-07-23T13:19:31Z,它将用于我的源连接 url。
For this i supplied utcnow() function in the value tab.为此,我在值选项卡中提供了 utcnow() function。 But i realized utcnow() will return the value as "2018-04-15T13:00:00.0000000Z"但我意识到 utcnow() 会将值返回为“2018-04-15T13:00:00.0000000Z”
To remove the millisecond part i have used the expression substring(utcnow(),1,20).为了删除毫秒部分,我使用了表达式 substring(utcnow(),1,20)。 and also used expression formatDateTime('utcnow()', 'yyyy-MM-ddTHH:mm:ss').并且还使用了表达式 formatDateTime('utcnow()', 'yyyy-MM-ddTHH:mm:ss')。
Both my trails are useless where my expression returning error ass invalid parameter.在我的表达式返回错误和无效参数的情况下,我的两条路径都是无用的。
Could you please help me how can i supply the value 2020-07-23T13:19:31Z in Azure data factory datasource parameters.你能帮我我如何在 Azure 数据工厂数据源参数中提供值 2020-07-23T13:19:31Z。
You don't want utcNow inside quotes, here is an example from one of my pipelines using your format:您不希望 utcNow 在引号内,这是我的一个管道中使用您的格式的示例:
@formatDateTime(utcnow(), 'yyyy-MM-ddTHH:mm:ss')
which gives this result, setting a variable named x:这给出了这个结果,设置了一个名为 x 的变量:
{
"name": "x",
"value": "2020-07-24T13:44:42Z"
}
Build it in 'Add dynamic content' as you can pick the functions and it will format properly if you aren't familiar.在“添加动态内容”中构建它,因为您可以选择功能,如果您不熟悉它会正确格式化。
Your substring won't work because it requires a string for the first parameter and utcnow is a timestamp.您的 substring 将不起作用,因为它需要一个字符串作为第一个参数,而 utcnow 是一个时间戳。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.