aspx thread: Returning the week of the month-- a function.
Built this VB.NET function, thought I would share if you need it. It returns
the week of the month (e.g. 3) for a datetime object(e.g. 9/19/2002):
Private Function getWeek(ByVal DateStr As DateTime) As String
Dim WOY1Date As DateTime
Dim WOY1Str As String
Dim WOY1, WOY2 As Integer
WOY1Str = DateTime.Parse(DateStr).Month & "/1/" &
DateTime.Parse(DateStr).Year
WOY1Date = DateTime.Parse(WOY1Str)
WOY1 = DatePart(DateInterval.WeekOfYear, WOY1Date)
WOY2 = DatePart(DateInterval.WeekOfYear, DateStr)
Return (WOY2 - WOY1) + 1
End Function
Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com