R Rick Brandt Nov 3, 2003 #2 Alex Soren said: How to find number of days in a month inside a query Click to expand... Do you need to evaluate a month by number, or by starting with a date value? For the former (1 = January, 12 = December, etc.)... DaysInMonth: Day(DateSerial(Year(Date()), [YourField]+1, 0)) For the latter (using a date field)... DaysInMonth: Day(DateSerial(Year(Date()), Month([YourField])+1, 0))
Alex Soren said: How to find number of days in a month inside a query Click to expand... Do you need to evaluate a month by number, or by starting with a date value? For the former (1 = January, 12 = December, etc.)... DaysInMonth: Day(DateSerial(Year(Date()), [YourField]+1, 0)) For the latter (using a date field)... DaysInMonth: Day(DateSerial(Year(Date()), Month([YourField])+1, 0))
B Brian Camire Nov 3, 2003 #3 Assuming you have fields named "Month" (with values from 1 to 12) and "Year" (with the four-digit year), you might use an expression something like this: DateDiff("d", DateSerial([Year], [Month], 1), DateSerial([Year], [Month] + 1, 1))
Assuming you have fields named "Month" (with values from 1 to 12) and "Year" (with the four-digit year), you might use an expression something like this: DateDiff("d", DateSerial([Year], [Month], 1), DateSerial([Year], [Month] + 1, 1))
B Bruce M. Thompson Nov 4, 2003 #4 How to find number of days in a month inside a query I assume that you are using a field containing a date so that your value will account for leap year: Format(DateSerial(Year([MyDateField]),Month([MyDateField])+1,0),"d") .... or ... Datepart("d",DateSerial(Year([MyDateField]),Month([MyDateField])+1,0))
How to find number of days in a month inside a query I assume that you are using a field containing a date so that your value will account for leap year: Format(DateSerial(Year([MyDateField]),Month([MyDateField])+1,0),"d") .... or ... Datepart("d",DateSerial(Year([MyDateField]),Month([MyDateField])+1,0))