在 azure logic apps 表达式中获取最大时间戳
get max timestamp in azure logic apps expression
所以日期以字符串格式到达。
我正在尝试转换为时间戳并找到最大的 value/newest 时间戳。
我很难从字符串转换为刻度,然后转换为时间戳,同时最后只得到最大的日期。
我的公式
addToTime('0001-01-01T00:00:00Z', div(max( ticks(formatDateTime(items('For_each_2')?['document_date'])),ticks(formatDateTime(items('For_each_2')?['requested_date'])),ticks(formatDateTime(items('For_each_2')?['promised_date'])),ticks(formatDateTime(items('For_each_2')?['shipment_date'])),ticks(formatDateTime(items('For_each_2')?['posting_date']))),10000000),'second')
错误
InvalidTemplate. Unable to process template language expressions in action 'Update_item' inputs at line '1' and column '3049': 'The template language function 'addToTime' could not create time value with time interval '-701917440' and time unit 'second'. It results in an out of time range value.'.
正确的表达应该如下所示:
addToTime('1970-01-01T00:00:00Z',div(sub(variables('maxticks'), 621355968000000000),10000000),'second')
首先,我使用以下表达式从三个日期获得最大滴答数:
int(max(ticks(formatDateTime(triggerBody()['now'])),ticks(formatDateTime(triggerBody()['yesterday'])),ticks(formatDateTime(triggerBody()['tomorrow']))))
然后获取最大时间戳:
所以日期以字符串格式到达。 我正在尝试转换为时间戳并找到最大的 value/newest 时间戳。
我很难从字符串转换为刻度,然后转换为时间戳,同时最后只得到最大的日期。
我的公式
addToTime('0001-01-01T00:00:00Z', div(max( ticks(formatDateTime(items('For_each_2')?['document_date'])),ticks(formatDateTime(items('For_each_2')?['requested_date'])),ticks(formatDateTime(items('For_each_2')?['promised_date'])),ticks(formatDateTime(items('For_each_2')?['shipment_date'])),ticks(formatDateTime(items('For_each_2')?['posting_date']))),10000000),'second')
错误
InvalidTemplate. Unable to process template language expressions in action 'Update_item' inputs at line '1' and column '3049': 'The template language function 'addToTime' could not create time value with time interval '-701917440' and time unit 'second'. It results in an out of time range value.'.
正确的表达应该如下所示:
addToTime('1970-01-01T00:00:00Z',div(sub(variables('maxticks'), 621355968000000000),10000000),'second')
首先,我使用以下表达式从三个日期获得最大滴答数:
int(max(ticks(formatDateTime(triggerBody()['now'])),ticks(formatDateTime(triggerBody()['yesterday'])),ticks(formatDateTime(triggerBody()['tomorrow']))))
然后获取最大时间戳: