Home > Archive > MS SQL Server > October 2006 > Number of Days Of Week









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Number of Days Of Week
Jim.Mueksch@wellsfargo.com

2006-10-28, 7:14 pm

Hi,


I need to find the number of Mondays within a given date range.

Example: How many Mondays between 01/01/2006 and 06/30/2006.

Any suggestions on how to do this?


Jim

Uri Dimant

2006-10-31, 12:15 am

declare @date1 datetime set @date1 = '20061001'
declare @date2 datetime set @date2 = '20061029'
declare @anyMonday datetime set @anyMonday = '19000102'

select
datediff(day,@anyMon
day,@date2)/7 -
datediff(day,@anyMon
day,@date1)/7 as MondayBetween





<Jim.Mueksch@wellsfargo.com> wrote in message
news:1161982195.940615.282480@k70g2000cwa.googlegroups.com...
> Hi,
>
>
> I need to find the number of Mondays within a given date range.
>
> Example: How many Mondays between 01/01/2006 and 06/30/2006.
>
> Any suggestions on how to do this?
>
>
> Jim
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com