Hi, I have a process where I need to get data through http request. Every loop I have to add one day to date, but I don’t know how to do this. Please can someone help with this.
I have a variable “dateTo” with type of System.DateTime and the format needs to be yyyy-MM-dd
When I do a http request I’place this to the request(no problem for placing the value).
But the issues which I need help are:
Add one day to dateTo variable in for each loop. for example the date is 1900-01-01 and in the next round it should be 1900-01-02. Also does the month change automatically if the date is 1900-01-31 and at the next round the month should be also changed?
How to format the datetime format from 01/01/1900 to 1900-01-01?
For some reason the year is lost with this:
I assign DateFrom = 1899-01-01
Log Message variable value = 01/01/1899 00:00:00
Then do
NewDateFrom = DateFrom.AddDays(1)
Log message variable value = 01/02/0001 00:00:00
We can use this expression Now.AddDays(-1).ToString(“yyyy-MM-dd”)
Before the for each row loop or for each loop use a
assign activity like this Str_date = Now.AddDays(-1).ToString(“yyyy-MM-dd”)
Where Str_date is a string variable
Then inside the loop use a assign activity like this Str_date = DateTime.ParseExact(Str_date,”yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture).AddDays(1).ToString(“yyyy-MM-dd”)
So for each iteration it will get added up
And the finally for this
Same
If the input is
str_input = “01/01/1900“
Then the output be like this Str_output = DateTime.ParseExact(Str_date,”yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)
That’s all you are done
Kindly try this and let know for any queries or clarification
Cheers @hemuli