我想将管道触发时间格式化为以下格式:
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'
我该如何解决这个问题?
The formatDateTime
函数使用您可以看到列出的自定义日期格式字符串here https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings。详细分解
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')
我使用“设置变量”活动测试了表达式并得到了以下结果:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)