In Power Automate, the datedifference
function is used to calculate the difference between two dates. It lets you to determine the duration in terms of days, months, or years between the specified dates.
Utilizing the dateDifference() expression requires only two values within a single expression. The expression takes a start datetime and an end datetime as input, resulting in a string output of d.hh:mm:ss.fffffff. This output represents the cumulative duration of days, hours, minutes, seconds, and fractional seconds between the two provided date times.
Syntax:
datedifference(start_date, end_date)
Parameters:
start_date
: The starting date for the calculation.end_date
: The ending date for the calculation.
Example usage:
datedifference(formatDateTime('2023-05-01','yyyy-MM-dd'), utcNow())
This will provide an output in the form of 49.23:31:36.2190667
Splitting the timespan components
split(outputs('Compose'),':')
Getting Days
first( split( outputs('Compose_-_Split')[0], '.') )
Getting Hours
last(split(outputs('Compose_-_Split')[0], '.'))
Getting Minutes
outputs('Compose_-_Split')[1]
Full Output