首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Azure Data Factory中使用formatDateTime?

如何在Azure Data Factory中使用formatDateTime?
EN

Stack Overflow用户
提问于 2021-03-10 16:24:58
回答 1查看 4.1K关注 0票数 2

我想将管道触发时间格式化为以下格式:

代码语言:javascript
复制
10-Mar-2021 08:31:59 AM

下面是我使用的代码:

代码语言:javascript
复制
@formatDateTime(pipeline().TriggerTime, 'DD-MON-YYYY HH:MI:SS AM/PM')

但是,日期的格式如下:

代码语言:javascript
复制
'DD-3ON-YYYY 08:3I:SS A3/P3'

有人能帮我解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-10 18:08:29

formatDateTime函数使用自定义日期格式字符串,您可以看到列出的here。详细的细目

代码语言:javascript
复制
dd - the day of the month from 01 to 31.  Note this is lower case and this format gives a leading 0.  Using d for no leading 0
MMM - the abbreviated name of the month, eg JAN, FEB, MAR.  Note this is upper case
yyyy - the year as a four-digit number.  Note this is lower case
hh - the hour using a 12-hour clock from 01 to 12.  Note this is lower case.  As you are using AM/PM it makes sense to have the 12-hour clock rather than 24 (ie 23:00 PM would not make sense).  Note this is lower case
mm - the minute from 00 to 50.  Note this is lower case
ss - the second from 00 to 50.  Note this is lower case
tt - the AM/PM designator.  Note this is lower case

因此,使用这些信息,您的代码应该更像这样:

代码语言:javascript
复制
@formatDateTime(pipeline().TriggerTime, 'dd-MMM-yyyy hh:mm:ss tt')

我使用Set Variable activity测试了表达式,得到了以下结果:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66560903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档