如何在Azure数据工厂中使用FormDateTime? [英] How to use formatDateTime in Azure Data Factory?

查看:12
本文介绍了如何在Azure数据工厂中使用FormDateTime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

10-Mar-2021 08:31:59 AM

以下是我使用的代码:

@formatDateTime(pipeline().TriggerTime, 'DD-MON-YYYY HH:MI:SS AM/PM')

但是,日期的格式如下:

'DD-3ON-YYYY 08:3I:SS A3/P3'

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

推荐答案

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

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

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

@formatDateTime(pipeline().TriggerTime, 'dd-MMM-yyyy hh:mm:ss tt')

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

这篇关于如何在Azure数据工厂中使用FormDateTime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆