Days in month
From: Chris Nebinger (anonymous_at_discussions.microsoft.com)
Date: 04/23/04
- Next message: Mitch: "Days in month"
- Previous message: Albert D. Kallal: "Re: Database Split"
- In reply to: Craig: "Days in month"
- Next in thread: Mitch: "Days in month"
- Reply: Mitch: "Days in month"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 23 Apr 2004 10:11:56 -0700
Not a built in, but the UDF is pretty simple:
Function DaysInMonth(dteDay) As Integer
Dim dteTemp As Date
'Get the first day of the current month
dteTemp = DateSerial(Year(dteDay), Month(dteDay), 1)
'Add 1 month
dteTemp = DateAdd("m", 1, dteTemp)
'Subtract 1 day to get last day of previous month
dteTemp = dteTemp - 1
'Number of days in the month is the day part
DaysInMonth = Day(dteTemp)
End Function
Call it like: DaysInMonth(Now)
Chris Nebinger
>-----Original Message-----
>Hi all,
> is there a function that will
>give the number of days in a month that works with the NOW
>() function ? I have looked through help and I can't see
>anything obvious...
>.
>
- Next message: Mitch: "Days in month"
- Previous message: Albert D. Kallal: "Re: Database Split"
- In reply to: Craig: "Days in month"
- Next in thread: Mitch: "Days in month"
- Reply: Mitch: "Days in month"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|