No of times a specific day occurs in a time duration

  • Thread starter Thread starter Muhahid Khan via .NET 247
  • Start date Start date
M

Muhahid Khan via .NET 247

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

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