# question

## How to find interval in days,week or days month or days

I have to find the total no of month, days or month, weeks or weeks days or only days on the basis of interval between start and end date which user gives the input. Like if `the interval between two dates is not more than 30` than output should be only in days` For example- StartDate - 1 July EndDate-24 July %|-110116387_1|% Day 1 July 24 July Interval is more than 30 days but less than 90 Days` than output should only in days and weeks and my week start from Monday and ends on Sunday For example- StartDate - 1 July 2015 EndDate-23 September 2015 Time_Type StartDate EndDate Day 1-07-2015 5-07-2015 Week Week2(july) Week3(September) Day 21-09-2015 23-09-2015 `Interval is more than 90 Days than` output should be in days and months For example- StartDate – 22 April 2015 EndDate-8 December 2015 Time_Type StartDate EndDate Day 22-04-2015 30-04-2015 Week May2015 November 2015 Day 01-12-2015 08-12-2015 Here the weeks can be the no of week by year wise like week2 (July) would be 26 week.This is needed in a project and its urgent also please do help me!!! Thank you!

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

What have you tried so far?
1 Like 1 ·
I have used datediff, dateadd but problem is that I have to make a entry only when there is whole month or week. IF the start day is tuesday we will go to we will go to the first monday which is on or after start date then from there to sunday on or before end date...I can't solve this part
0 Likes 0 ·
SELECT DATENAME(DAY,GETDATE()) + ' ' + DATENAME(MONTH,GETDATE()) SELECT 'Week ' + CAST(DATEPART(WEEK,GETDATE()) - DATEPART(WEEK,DATENAME(YEAR,GETDATE()) + '/' + DATENAME(MONTH,GETDATE()) + '/' + '1') AS NVARCHAR)+ ' ' + DATENAME(MONTH,GETDATE()) SELECT DATENAME(MONTH,GETDATE()) + ' ' + DATENAME(YEAR,GETDATE()) this is I have tried so far...
0 Likes 0 ·