datetime difference between two dates in minutes

r0909 6 Reputation points
2020-06-03T14:36:34.147+00:00

In my pipeline, Iam having two variables (of type string) which is holding two different datetimestamp (UTC) . I want to know the difference between these two timestamps in minutes. Is it possible in Azure data factory?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,477 questions
{count} vote

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 601 Reputation points
    2020-06-05T20:06:13.33+00:00

    Hello @r0909

    You can use the tick function to work around this as we do not have an inbuild function get the time difference between two variable ( in mins ) .

    You can use an expression like for one of the variables :

    @string(ticks(variables('data1')))   
    

    and

    @string(ticks(variables('data2')))   
    

    for the other . Since 1 tick = 100 nanosecond .
    you can use the below expression to convert to mins :

    @String(div(sub(int(variables('datediff2')),int(variables('datadiff'))),600000000))  
    

    Please do let me know how it goes .

    ----------

    Thanks Himanshu

    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    3 people found this answer helpful.
    0 comments No comments