How to find First Sunday of each month

Here is the funtion in vb.net to find the first Sunday of each month

Function GetFirstSunday(ByVal dt As Date) As String

Dim inputDate As DateTime

Dim outputDate As DateTime

inputDate = Convert.ToDateTime(dt)

‘ Start at the day 1

outputDate = New DateTime(inputDate.Year, inputDate.Month, 1)

‘Loop through the month looking for the first Sunday

For i As Int32 = 0 To Date.DaysInMonth(outputDate.Year, outputDate.Month)

If outputDate.AddDays(i).DayOfWeek = DayOfWeek.Sunday Then

outputDate = outputDate.AddDays(i)

Exit For ‘We’re done.. get out of the loop

End If

Next

GetFirstSunday = FormatDateTime(outputDate, DateFormat.LongDate)

End Function