Home All Groups Group Topic Archive Search About
Author
6 Jan 2006 3:42 PM
Newbie
I need the following functions using the standards for Week Numbering IE
Week one is the first week with a thursday in it.

getWeekStartDate(  WeekNum as Integer ,  YearNumber as Integer ) as Date
getWeekEndDate (  WeekNum as Integer ,  YearNumber as Integer ) as Date
getWeekNumber (   dateToCheck as Date ) as Integer
numWeeksInYear(   year as Integer ) as Integer

Does anyone know if there are these functions ?

Cheers -

Author
6 Jan 2006 8:52 PM
Mr Newbie
here is the basis

Function getWeek1Monday(ByVal year As Integer) As Date

Dim Jan1st As Date = New Date(year.ToString, 1, 1)

If Jan1st.DayOfWeek <= DayOfWeek.Thursday Then

Return DateAndTime.DateAdd(DateInterval.Day, 1 - Jan1st.DayOfWeek, Jan1st)

Else

Return DateAndTime.DateAdd(DateInterval.Day, 8 - Jan1st.DayOfWeek, Jan1st)

End If

End Function


--
Best Regards

The Inimitable Mr Newbie  º¿º
Show quoteHide quote
"Newbie" <m*@me.com> wrote in message
news:uEApTftEGHA.2300@TK2MSFTNGP15.phx.gbl...
>I need the following functions using the standards for Week Numbering IE
>Week one is the first week with a thursday in it.
>
> getWeekStartDate(  WeekNum as Integer ,  YearNumber as Integer ) as Date
> getWeekEndDate (  WeekNum as Integer ,  YearNumber as Integer ) as Date
> getWeekNumber (   dateToCheck as Date ) as Integer
> numWeeksInYear(   year as Integer ) as Integer
>
> Does anyone know if there are these functions ?
>
> Cheers -
>
>
>
>
>