Ciao a tutti.
Selezioando 2 date devo calcolare le ore lavorate. Dal Lunedi' al Giovedi' sono 8,30 mentre il Venerdi' sono 7,30.
Sto' cercando di mettere in piedi questa funzione ma non riesco.
Qualcuno potrebbe aiutrami?
Public Function OreLavorative(ByVal startDate As Date, ByVal endDate As Date) As Integer
Dim DaysPassed As Integer = DateDiff(DateInterval.Hour, startDate, endDate)
Dim SaturdaysPassed As Integer = DateDiff(DateInterval.WeekOfYear, _
startDate, endDate, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
Dim SundaysPassed As Integer = DateDiff(DateInterval.WeekOfYear, startDate, _
endDate, Microsoft.VisualBasic.FirstDayOfWeek.Monday)
Dim WeekdaysPassed As Integer = DaysPassed - SaturdaysPassed - SundaysPassed
Return WeekdaysPassed
End Function

Rispondi quotando