skip to Main Content

I have below code which is not working in ADF.

Are there any alternative functions to get difference between two dates.

Below is my code:

DATEDIFF("DD",START_DATE,END_DATE)<=10

Can someone please check and advise me how to proceed with this.

2

Answers


  1. for day difference :
    We would convert the Date to the Tick values and take a difference of the Tick values, post which would convert the Tick to the corresponding Day conversion value.

    @div(sub(variables(‘Tick2’),variables(‘Tick1’)),variables(‘Day’))

    The below blogs explain the same:
    https://www.c-sharpcorner.com/article/implementing-datediff-function-in-data-factory-synapse-via-pipeline-expression/

    https://datasharkx.wordpress.com/2023/09/25/implementing-datediff-function-in-data-factory-synapse-via-pipeline-expressions/

    Login or Signup to reply.
  2. Try using tick function which return the ticks property value for a specified timestamp. A tick is a 100-nanosecond interval.

    div(div(sub(ticks(formatDateTime(parameters.START_DATE,'yyyy-MM-dd')),ticks(formatDateTime(pipeline().parameters.END_DATE,'yyyy-MM-dd'))),36000000000),24)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search