如何在逻辑应用程序中将字符串时间处理为 ISO 格式
how to process string Time to ISO format in logic app
我有逻辑应用程序,我使用 sql 中的以下表达式获取时间值。
formatDateTime(convertFromUtc(utcNow(),'Pacific Standard Time'),'HHmmss')
我得到的值是 234310
现在我想从这个时间减去 3 分钟,因为我写在下面的表达式中。
对于上面的@Meyer 建议,我有解决方案,比如我可以先减去然后进行格式化,但在其他情况下,我从 sql table 得到 002322
值,在这种情况下,如果我转换并减去它给出的值为 2322
,这是错误的值。在这种情况下可能的解决方案是如何从 002322
中减去 3 分钟
subtractFromTime(formatDateTime(convertFromUtc(utcNow(),'Pacific Standard Time'),'HHmmss'),3,'Minute')
但出现错误 -
InvalidTemplate. Unable to process template language expressions in action 'Initialize_variable' inputs at line '1' and column '3443': 'In function 'subtractFromTime', the value provided for date time string '003417' was not valid. The datetime string must match ISO 8601 format.
我什至试过了Date Time Action
我试过这样解决你的问题,似乎能得到你想要的结果:
formatDateTime(convertFromUtc(addMinutes(utcNow(), -3),'Pacific Standard Time'),'HHmmss')
你可以先减去3分钟,再换算你的时间。
我测试了一下,好像没问题:
我有逻辑应用程序,我使用 sql 中的以下表达式获取时间值。
formatDateTime(convertFromUtc(utcNow(),'Pacific Standard Time'),'HHmmss')
我得到的值是 234310
现在我想从这个时间减去 3 分钟,因为我写在下面的表达式中。
对于上面的@Meyer 建议,我有解决方案,比如我可以先减去然后进行格式化,但在其他情况下,我从 sql table 得到 002322
值,在这种情况下,如果我转换并减去它给出的值为 2322
,这是错误的值。在这种情况下可能的解决方案是如何从 002322
subtractFromTime(formatDateTime(convertFromUtc(utcNow(),'Pacific Standard Time'),'HHmmss'),3,'Minute')
但出现错误 -
InvalidTemplate. Unable to process template language expressions in action 'Initialize_variable' inputs at line '1' and column '3443': 'In function 'subtractFromTime', the value provided for date time string '003417' was not valid. The datetime string must match ISO 8601 format.
我什至试过了Date Time Action
我试过这样解决你的问题,似乎能得到你想要的结果:
formatDateTime(convertFromUtc(addMinutes(utcNow(), -3),'Pacific Standard Time'),'HHmmss')
你可以先减去3分钟,再换算你的时间。
我测试了一下,好像没问题: