How to take previous quarter in uipath

@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.

6 Likes