ISO Date Functions

  • Thread starter Thread starter Newbie
  • Start date Start date
N

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 -
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top