I need to have a value in the variable which returns the number of days starting from 1st Jan.
Like suppose for example:
If the workflow is executed today (19th Aug 2019), then output is:-
= (Jan + Feb + Mar + Apr + May + Jun + Jul + (19 days of Aug)
= 31+28+31+30+31+30+31+19
= 231
Hence,
Input = None. (since we can get the current date)
Output = 231.
NOTE:- Need to consider Leap year into this.
Please help me with this.
Hi
Hope this would help you
Input will be like DateTime.DaysInMonth(year, month) +…for all months + Now.Date
We need to convert to int32
Like
Convert.ToInt32(DateTime.DaysInMonth(year, month))+…for all months + Convert.ToInt32(Now.Date)
@hacky
So the steps involved are as follows
—use a assign activity like this Inmonth = Convert.ToInt32(Now.ToString(“MM”)) Inyear = Convert.ToInt32(Now.ToString(“yyyy”))
Where Inmonth and Inyear is a int32 variable
—now use a while loop and pass the above variable as input with a Counter variable of type int32 with default value 0 Counter < Inmonth
—inside the loop use a assign activity Innoofdays = Convert.ToInt32(DateTime.DaysInMonth(Inyear, Counter+1) + Innoofdays
Where Innoofdays is a int32 variable of default value 0
Next to this while loop use a assign activity like Final_noofdays = Innoofdays + Convert.Toint32( Now.Date)
Hope these would help you resolve this
Cheers @hacky
In my case, our financial year starts from 1st April. So need to have a variable as:
April + May + June + July (NOTE:- We need to ignore the 19 days of August).
So, 30 + 31+ 30 + 31 = 122…!
(So if we run the flow in August (any day of August) we need only days up to July)