How to take previous quarter in uipath

jan,feb,march
apr,may,jun
jul,aug,sep
oct,nov,dec

currently month is feb i want to take previous quater as oct to dec (10/01/2018) to (12/31/2018) please help me to find solution

1 Like

Hi create a datetime
There you can do addmonths(3) To find the next period
Ex create a new datetime: new datetime (1900,1,31) @brindhaS

@brindhaS

  1. Create a workflow with two arguments,
    outPrevQuarterStartDate and outPrevQuarterEndDate with datetime datatype
  2. Get previous quarter date based on current date
    datePrevQuarterDate = DateTime.Now.AddMonths(-3)
  3. Find previous quarter number
    intPrevQuarterNumber = Convert.ToInt16((datePrevQuarterDate.Month - 1)/3+1)
  4. Find start date of prev quarter
    outPrevQuarterStartDate = new DateTime(datePrevQuarterDate.Year, (intPrevQuarterNumber-1)*3+1,1)
  5. Find end date of prev quarter
    outPrevQuarterEndDate = outPrevQuarterStartDate.AddMonths(3).AddDays(-1)

Hope this is helpful!
If this gives solution for your problem, please mark it as solution so that people facing similar issues will be redirected to the solution directly.

4 Likes

thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.