'первый день недели(FirstDayInWeek)
Function fun_FirstDayInWeek(ByVal dDate As Date) As Date
Dim intDay As Integer
If TypeName(dDate) = "Date" Then
intDay = DatePart("w", dDate, 0, 0)
fun_FirstDayInWeek = Format(dDate - intDay + 1, "DD.MM.YYYY")
End If
End Function
'последний день недели(LastDayInWeek)
Function fun_LastDayInWeek(ByVal dDate As Date) As Date
Dim intDay As Integer
If TypeName(dDate) = "Date" Then
intDay = DatePart("w", dDate, 0, 0)
fun_LastDayInWeek = Format(dDate + 7 - intDay, "DD.MM.YYYY")
End If
End Function
'последний день месяца
Function fun_LastDayInMonth(ByVal dDate As Date) As Date
Dim intDay As Integer
Dim intYear As Integer
Dim intMonth As Integer
If TypeName(dDate) = "Date" Then
intMonth = Month(dDate) + 1
intYear = Year(dDate)
If intMonth = 13 Then
intMonth = 1
intYear = intYear + 1
End If
fun_LastDayInMonth = DateSerial(intYear, intMonth, 0)
' fun_LastDayInMonth = Day(lastDate) '31
End If
End Function