Hello,
I'm new here so sorry if this question isn't worded how they usually are but I can't figure out how to get vb to only display the dates of working days (Monday - Friday). I have got it to calculate days between certain dates (I thought that might get me somewhere but it hasn't).
I want 5 labels to say the day of the week the what the date is so for example;
Monday; 30th Dec.
Tuesday; 31st Dec.
Wednesday; 1st Jan.
Thursday; 2nd Jan.
Friday; 3rd Jan.
I'd want this then to repeat week after week but don't know where to start.
Thanks in advance - any guidance would be great!
From,
Luke

Start with this

Dim sdate As Date = CDate("2014-01-01")
Dim edate As Date = CDate("2014-01-31")

Do While sdate <= edate
    If IsWeekDay(sdate) Then
        ListBox1.Items.Add(sdate & " " & WeekdayName(Weekday(sdate)))
    End If
    sdate = DateAdd(DateInterval.Day, 1, sdate)
Loop

Private Function IsWeekDay(d As Date) As Boolean
    Return d.DayOfWeek >= DayOfWeek.Monday And
           d.DayOfWeek <= DayOfWeek.Friday
End Function

This shows how to determine if a date falls between Monday and Friday.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.