Start New Discussion within our Software Development Community

I am developing a code where im getting the interval of two dates
for example
DTLeavePayFrom = 1/1/2013
DTLeavePayTo = 1/14/2013

since 1/1/2013 is tuesday and 1/14/2013 is monday, the date diff of both date is 14
but how can i exclude the count of 2 sundays,

i have an existing code of date diff:

        Dim daycount As Integer = DateDiff(DateInterval.Day, DTLeavePayFrom.Value, DTLeavePayTo.Value)

Please help me, Thanks alot!

Label1 will display the number of days....

          Dim count = 0
          Dim totalDays = (DTLeavePayTo.Value - DTLeavePayFrom.Value).Days
          Dim startDate As Date

          For i = 0 To totalDays
               Dim weekday As DayOfWeek = startDate.AddDays(i).DayOfWeek
               If weekday <> DayOfWeek.Sunday Then
                    count += 1
               End If
          Label1.Text = count
This question has already been answered. Start a new discussion instead.