Question: I am using SQL Server 2008. I want to get Start Date and End Date of all quarters of year. For example if I pass 2013 in query then output should like

```
StartDate                 EndDate                   QuarterNo
-------------------------------------------------------------
2013-04-01 00:00:00.000   2013-06-30 00:00:00.000      1
2013-07-01 00:00:00.000   2013-09-30 00:00:00.000      2
2013-10-01 00:00:00.000   2013-12-31 00:00:00.000      3
2014-01-01 00:00:00.000   2014-03-31 00:00:00.000      4

```

Because of Financial Year start from 1st April, I want to get 1st quarter start from 1st April. How can I get this output? Thanks for help...

Answer: 
One more way to do it

```
SELECT DATEADD(mm, (quarter - 1) * 3, year_date) StartDate,
       DATEADD(dd, -1, DATEADD(mm, quarter * 3, year_date)) EndDate,
       quarter QuarterNo
  FROM
(
  SELECT '2013-04-01' year_date
) s CROSS JOIN 
(
  SELECT 1 quarter UNION ALL
  SELECT 2 UNION ALL
  SELECT 3 UNION ALL
  SELECT 4
) q

```

Output:

```

| StartDate  |    EndDate | QuarterNo |
|------------|------------|-----------|
| 2013-04-01 | 2013-06-30 |         1 |
| 2013-07-01 | 2013-09-30 |         2 |
| 2013-10-01 | 2013-12-31 |         3 |
| 2014-01-01 | 2014-03-31 |         4 |

```

Here is **[SQLFiddle](http://sqlfiddle.com/#!3/d41d8/20861)** demo
```
SELECT 
    CAST(DATEADD(M,3*(NUMBER-1),DATEADD(YYYY,DATEDIFF(YYYY,0,GETDATE()),0)) AS DATE) [QT START DATE]
    , CAST(DATEADD(D,-1,DATEADD(M,3*(NUMBER),DATEADD(YYYY,DATEDIFF(YYYY,0,GETDATE()),0))) AS DATE) [QT END DATE]
    , NUMBER AS [QUARTER NAME]
FROM MASTER..SPT_VALUES 
WHERE TYPE='P' 
    AND NUMBER BETWEEN 1 AND 4

```