first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Start/End of Month Functions basSOM() and basEOM()

Public Function basEOM(TheDate As Date)

Dim dtmNextMonth As Date

dtmNextMonth = VBA.DateAdd("m", 1, TheDate)
'
'By subtracting all of the days out of dtmNextMonth
'for a given date (TheDate), the last day of the previous 
'month is returned by the DateValue method
'of the VBA object.
'
basEOM = VBA.DateValue(dtmNextMonth - _ 
    VBA.DatePart("d", dtmNextMonth))

End Function

Public Function basSOM(TheDate As Date) ' 'By subtracting all of the days out of TheDate 'and adding one, the first day of the month for TheDate 'is returned by the DateValue method of the VBA object. ' basSOM = VBA.DateValue(TheDate - _ DatePart("d", TheDate) + 1)

End Function

mod date: 1999-07-31T16:00:09.000Z