https://msdn.microsoft.com/ru-ru/library/office/hh134613(v=office.14).aspx
'=======================================================================================
'первый день недели(FirstDayInWeek)
Function funFirstDayInWeek(ByVal dDate As Date) As Date
Dim intDay As Integer
If TypeName(dDate) = "Date" Then
intDay = DatePart("w", dDate, 0, 0)
funFirstDayInWeek = Format(dDate - intDay + 1, "DD.MM.YYYY")
End If
End Function
'последний день недели(LastDayInWeek)
Function funLastDayInWeek(ByVal dDate As Date) As Date
Dim intDay As Integer
If TypeName(dDate) = "Date" Then
intDay = DatePart("w", dDate, 0, 0)
funLastDayInWeek = Format(dDate + 7 - intDay, "DD.MM.YYYY")
End If
End Function
'=======================================================================================
VBA
? FirstDayInMonth(#2/15/2012#)
? LastDayInMonth(#2/15/2012#)
? FirstDayInWeek
? LastDayInWeek
? FirstDayInYear(Date)
? LastDayInYear(Date)
SQL
SELECT DateTable.TestDate,
FirstDayInMonth([TestDate]) AS FirstDayInMonth,
LastDayInMonth([TestDate]) AS LastDayInMonth,
FirstDayInYear([TestDate]) AS FirstDayInYear,
LastDayInYear([TestDate]) AS LastDayInYear,
FirstDayInWeek([TestDate]) AS FirstDayInWeek,
LastDayInWeek([TestDate]) AS LastDayInWeek
FROM DateTable;
Public Function FirstDayInMonth(Optional dtmDate As Variant) As Date
If IsMissing(dtmDate) Then
dtmDate = Date
End If
FirstDayInMonth = DateSerial( _
Year(dtmDate), Month(dtmDate), 1)
End Function
FirstDayInMonth = DateSerial( _
Year(dtmDate), Month(dtmDate), 1)