# Finding Week of the Month

• ### Question

• Hi,

I want to find out week of the month.

A month consist of weeks and i want to find out which week of the current month.

Thanks.

Regards
Kashif

Sunday, May 10, 2009 6:12 AM

• Something like

Dim

a1 As DateTime = Today.ToString
Dim ciCurr As CultureInfo = CultureInfo.CurrentCulture
Dim weekNum As Double = (ciCurr.Calendar.GetDayOfMonth(a1)) / 7

If
weekNum <= 1 Then
MsgBox("First Week")
ElseIf weekNum > 1 And weekNum <= 2 Then
MsgBox("Second Week")
ElseIf weekNum > 2 And weekNum <= 3 Then
MsgBox("Third Week")
ElseIf weekNum > 3 And weekNum <= 4 Then
MsgBox("Fourth Week")
ElseIf weekNum > 4 Then
MsgBox("Last Week")
End If

• Edited by Sunday, May 10, 2009 7:31 AM
• Proposed as answer by Sunday, May 10, 2009 4:15 PM
• Marked as answer by Wednesday, May 13, 2009 12:07 PM
Sunday, May 10, 2009 7:29 AM

### All replies

• You can divide by 7 and add 1.

So 18 would give 18 / 7 = 2 + 1 = 3

Thanks,
A.m.a.L

.Net Goodies
Sunday, May 10, 2009 6:27 AM
• Something like

Dim

a1 As DateTime = Today.ToString
Dim ciCurr As CultureInfo = CultureInfo.CurrentCulture
Dim weekNum As Double = (ciCurr.Calendar.GetDayOfMonth(a1)) / 7

If
weekNum <= 1 Then
MsgBox("First Week")
ElseIf weekNum > 1 And weekNum <= 2 Then
MsgBox("Second Week")
ElseIf weekNum > 2 And weekNum <= 3 Then
MsgBox("Third Week")
ElseIf weekNum > 3 And weekNum <= 4 Then
MsgBox("Fourth Week")
ElseIf weekNum > 4 Then
MsgBox("Last Week")
End If

• Edited by Sunday, May 10, 2009 7:31 AM
• Proposed as answer by Sunday, May 10, 2009 4:15 PM
• Marked as answer by Wednesday, May 13, 2009 12:07 PM
Sunday, May 10, 2009 7:29 AM