Groups | Blog | Home
all groups > vb.net > september 2004 >

vb.net : No of times a specific day occurs in a time duration


Muhahid Khan via .NET 247
9/6/2004 9:41:43 PM
Can Please some one let me know how can we find out the number of sundays or any specific day with in a specified date duration. I also should get the dates that occur with in the specified date.

--------------------------------
From: Muhahid Khan

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Cor Ligthert
9/7/2004 8:50:52 AM
Muhahid,

I made this sample for you, is that what you mean?
\\\
Dim mydate As Date = New Date(Now.Year, 1, 1)
Dim endpoint As Date = New Date(Now.AddYears(1).Year, 1, 1)
Do While mydate < endpoint
If mydate.DayOfWeek = DayOfWeek.Sunday Then
Console.Write(mydate.ToString & vbCrLf)
End If
mydate = mydate.AddDays(1)
Loop
///

I hope this helps?

Cor
..
"Muhahid Khan"
[quoted text, click to view]
or any specific day with in a specified date duration. I also should get the
dates that occur with in the specified date.

AddThis Social Bookmark Button