Murray Brown
asked on
VB.net Get list of weekdays in current month
Hi
What VB.net code would I use to get a list of the dates for working days from the start of the current month
up to today's date
What VB.net code would I use to get a list of the dates for working days from the start of the current month
up to today's date
Weekdays or working days? (There is a difference.)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I just improved Tomlinson's code by using the function AddDays:
Public Shared Function GetTotalWorkingDays() As List(Of DateTime)
Dim weekDays As New List(Of DateTime)()
Dim today As DateTime = DateTime.Now
Dim dt As DateTime = today.AddDays(1 - today.Day)
While dt <= today
If dt.DayOfWeek >= DayOfWeek.Monday AndAlso dt.DayOfWeek <= DayOfWeek.Friday Then
weekDays.Add(dt)
End If
dt = dt.AddDays(1)
End While
Return weekDays
End Function
ASKER
Thanks
Would have been nice to get an answer to my question : \