home / software / tips and tricks / How to find out the week days(Monday- Friday) from a date range

How to find out the week days(Monday- Friday) from a date range

Updated:  04/23/2010 08:04 AM
Author:  Shiju Mathews

Status:    Resolved.


Create a function then user the function for future use




select * from [Application].[udf_WeeksBetween]('1/1/2010','2/19/2010')

Output
RowNumber  MondayDate          FridayDate
1  2009-12-28 00:00:00.000  2010-01-01 00:00:00.000
2  2010-01-04 00:00:00.000  2010-01-08 00:00:00.000
3  2010-01-11 00:00:00.000  2010-01-15 00:00:00.000
4  2010-01-18 00:00:00.000  2010-01-22 00:00:00.000
5  2010-01-25 00:00:00.000  2010-01-29 00:00:00.000
6  2010-02-01 00:00:00.000  2010-02-05 00:00:00.000
7  2010-02-08 00:00:00.000  2010-02-12 00:00:00.000
8  2010-02-15 00:00:00.000  2010-02-19 00:00:00.000
Tags: How to find out the week days(Monday- Friday) from a date range
Updated on: November 2024