Hai all,
I have date :20/9/2022
And days to be subtract will be 12(12 is dynamic it may change according to requirements).
I need output 9/9/2022
Thanks in advance…
Hi , You may try the below expression in assign activity
Convert.toDateTime(“20/9/2022”).AddDays(-12)
You can use string variable instead of “20/9/2022” and integer instead of -12
Thanks,
Keerthana
we convert to DateTime, substract the days and reformat into the needed format
DateTime.ParseExact(strDate, "d/M/yyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(intOffset).ToString("d/M/yyyy")
feel free to adapt the formats
This worked but i need to pass variable instead of number -12… and that variable doesn’t contain -12 i.e., negative value it’s just 12
no problem just adapt the statement e.g. like:
DateTime.ParseExact(strDate, "d/M/yyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(- intOffset).ToString("d/M/yyyy")
so we just added - before the variable
Hi @cbhavana
You can try this
DateTime.ParseExact("1/9/2022", "d/M/yyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(-Cint(YourStringVariable)).ToString("d/M/yyyy")
Regards
Sudharsan
Yes. I am getting output. Thanks @Sudharsan_Ka
Great kindly close the topic by marking the solution @cbhavana
Regards
Sudharsan
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
