简体   繁体   English

如何从 utcnow() 中删除毫秒导致 Azure 数据工厂

[英]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.

相关问题 在 Azure 数据工厂中格式化 utcnow() - Format utcnow() in Azure Data Factory 使用 utcnow() 作为管道参数的 Azure 数据工厂 v2 - Azure Data Factory v2 using utcnow() as a pipeline parameter 用于创建新文件夹的 Azure 数据工厂 utcNow() 动态函数 - Azure Data Factory utcNow() dynamic function used to create new folder Azure 数据工厂将 \\ 替换为“\\\\”。 如何删除这个? - Azure Data Factory replace \ with '\\'. How to remove this? Azure 数据工厂 - 如何批量删除数据集? - Azure Data Factory - How to remove data sets in bulk? 使用 powershell 从 azure 数据工厂中的管道中删除触发器引用 - Remove trigger reference from pipeline in azure data factory using powershell 如何从 Azure 数据工厂中查找活动的输出中删除转义字符? - How to remove escape character from the output of Lookup activity in Azure Data Factory? 如何从 Azure 数据工厂中具有动态长度的字符串中删除最后三个字符? - How to remove the last three characters from a string with a dynamic length in Azure Data Factory? 如何使用 Azure 数据工厂或任何其他选项从存储在 ADLS 中的 XML 中删除特殊字符? - How to remove special characters from XML stored in ADLS using Azure data factory or any other option? 从 Azure 数据资源管理器中删除转义字符 - Remove escape characters from Azure Data Explorer JSON object in Azure Data Factory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM