14,300,942 members

# Get Quarter Starting and Ending Dates for a given Date

Rate this:
8 Aug 2010CPOL
Get Quarter Starting and Ending Dates for a given Date
When you want the Quarter Starting and Ending dates for a given date, here are simple functions to calculate.

```//whichQtr =  0 - present quarter
//           -1 - previous quarter
//            1 - next quarter
public static DateTime QuarterEnddate(DateTime curDate, int whichQtr)
{
int tQtr = (curDate.Month - 1) / 3 + 1 + whichQtr;
return new DateTime(curDate.Year, (tQtr * 3) + 1, 1).AddDays(-1);
}

public static DateTime QuarterStartDate(DateTime curDate, int whichQtr)
{
}```

## Share

 India
No Biography provided

 First Prev Next
 qtr 4 doesn't work zell7111-Jul-17 15:40 zell71 11-Jul-17 15:40
 Bug Mike_Liu18-Mar-15 2:54 Mike_Liu 18-Mar-15 2:54
 Anyway, I will rewrite function to accept starting month of ... Ravi LVS11-Aug-10 18:36 Ravi LVS 11-Aug-10 18:36
 I removed it intentionally, because it is creating some ambi... Ravi LVS11-Aug-10 18:31 Ravi LVS 11-Aug-10 18:31
 Hello Ravi, where is your QuarterOfDate() method? I think, i... Kunal Chowdhury «IN»9-Aug-10 22:55 Kunal Chowdhury «IN» 9-Aug-10 22:55
 - Kunal No No. Most of the times, every one needs quarter o... Ravi LVS21-Jul-10 7:59 Ravi LVS 21-Jul-10 7:59
 Ravi, I think Luc here is right. The QuarterOfDate() should ... Kunal Chowdhury «IN»21-Jul-10 6:53 Kunal Chowdhury «IN» 21-Jul-10 6:53
 - Luc Pattyn In India 1st qtr = Apr, May, Jun, 2nd Qtr = J... Ravi LVS20-Jul-10 8:50 Ravi LVS 20-Jul-10 8:50
 Reason for my vote of 2 bug Luc Pattyn20-Jul-10 7:48 Luc Pattyn 20-Jul-10 7:48
 QuarterOfDate seems quite wrong, it numbers the quarters as ... Luc Pattyn20-Jul-10 7:47 Luc Pattyn 20-Jul-10 7:47
 Reason for my vote of 5 Very Helpful. Kunal Chowdhury «IN»19-Jul-10 2:35 Kunal Chowdhury «IN» 19-Jul-10 2:35
 Awesome. Nice to see the code. It will be very useful for th... Kunal Chowdhury «IN»19-Jul-10 2:28 Kunal Chowdhury «IN» 19-Jul-10 2:28
 Thank you, I added the function as requested by you. Ravi LVS18-Jul-10 18:27 Ravi LVS 18-Jul-10 18:27
 Super... :) But you can include one method which will return... Kunal Chowdhury «IN»17-Jul-10 4:04 Kunal Chowdhury «IN» 17-Jul-10 4:04
 Last Visit: 18-Sep-19 13:54     Last Update: 18-Sep-19 13:54 Refresh 1