|
|
SynopsisGet Last Day of Month CODE ' GetLastDayOfMonth
' http://www.utteraccess.com/wiki/index.php/GetLastDayOfMonth ' Code courtesy of UtterAccess Wiki ' Licensed under Creative Commons License ' http://creativecommons.org/licenses/by-sa/3.0/ ' ' You are free to use this code in any application, ' provided this notice is left unchanged. ' ' rev date brief descripton ' 1.0 2011-03-27 ' Public Function GetLastDayOfMonth(Optional ByVal pDate) '110327 Crystal 'return a date the represents the last day of the month 'also called the EOM (End Of Month) ' 'if no date is passed, the current date is used ' ' examples: ' GetLastDayOfMonth("12 dec 2011") ' GetLastDayOfMonth(#1/2/2012#) ' GetLastDayOfMonth( [myDateField] ) ' GetLastDayOfMonth() ' If IsMissing(pDate) Then pDate = Date 'you may wish to remove IsNumeric from the following condition: If Not IsDate(pDate) And Not IsNumeric(pDate) Then Exit Function GetLastDayOfMonth = DateSerial(Year(pDate), Month(pDate) + 1, 0) End Function
|
| This page was last modified 09:11, 6 April 2011. This page has been accessed 640 times. Disclaimers |