I have a problem when I try to subtract a day from a DateTime variable.
I have a variable, let’s call it “Original_Date” which is equal to “01/07/2021” and has the dd/MM/yyyy format.
I then want to subtract a day from the variable Original_Date, by using: Original_date.addDays(-1).toString(“dd/MM/yyy”)
and save it as the variable “New_Date”
The dateTime variable New_Date should then be “30/07/2021”. Now it returns “01/06/2021”, which is wrong.
It subtracts a number of the month, and not the days as it should.
Can someone help me out? Thanks!
You can try with this expression
Use Assign Activity (Subtract Days)
Use Assign Activity (Subtract Month)
There should be .AddMonths available on your datetime, similar to .AddDays
This is from a colleague’s code,
neg is the amount of months you need to remove and is dynamic.
Perfect! Thank you @Gokul001
If it is work then mark as solved.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.