question

ewinkiser avatar image
0 Votes"
ewinkiser asked NK-1329 edited

ADF How can I add one day to the following expression?

Hi @nasreen-akter @MartinJaffer-MSFT @KranthiPakala-MSFT

I have a date of let's say 9/13 that I am passing through in a Web Call:

     **"EffectiveStart": "@{item().terminationdate}",**

How can I add one day so that the date shows as 9/14?

I just tried @{formatDateTime(adddays(item().terminationdate,+1), 'yyyy-MM-dd' )}
but that didn't work....any ideas? But now I'm seeing that termination date can be null also.

Thanks
Mike


azure-data-factory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ShaikMaheer-MSFT avatar image
0 Votes"
ShaikMaheer-MSFT answered NK-1329 edited

Hi @ewinkiser ,

Thank you for posting query in Microsoft Q&A Platform

Please check below detailed explanation to add one day.

I have two variables here "TerminationDate" & "TerminationDateNew". I have assigned value in "TerminationDate" as "2020-09-13".
Idea is to add one day to "TerminationDate" and store it in "TerminationDateNew" variable. To do the same I used below expression

@formatDateTime(adddays(variables('TerminationDate'),1),'yyyy-MM-dd')

108997-adddays.gif

Hope this will help. Thank you


  • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

  • Want a reminder to come back and check responses? Here is how to subscribe to a email-notifications


adddays.gif (2.1 MiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ShaikMaheer-MSFT

Thanks so much! That worked!!
Mike Kiser

0 Votes 0 ·

hi @ewinkiser ,

Glad to know that it worked for you. Thank you.

0 Votes 0 ·
NK-1329 avatar image NK-1329 ShaikMaheer-MSFT ·

@ShaikMaheer-MSFT

How do I use this in a copy data activity in ADF where the source is a .csv file and the sink is a SQL Server table and I want to transform the values of a source column (eg: expireOn) which has date values in the format 'yyyy-mm-dd hh:mm:ss.0000000' to a datetime column in sql server with the same name but with the format 'yyyy-mm-dd 00:00:00' where dd should be +1 days from the source. I am trying the following expression using dynamic content :

@formatDateTime(adddays(expireOn,1), 'yyyy-mm-dd 00:00:00')

But I cannot pass the source column name directly.

0 Votes 0 ·