daysInMonth

Determines the number of days in a month.

daysInMonth(date) → returns Numeric

Member Function Syntax

date.daysInMonth()

daysInMonth Argument Reference

date
Required

Date or date/time object.

Compatibility

ColdFusion:

Member function is available in CF 11+.

Lucee:

Member function is available in Lucee 4.5+.

Examples sample code invoking the daysInMonth function


Determines the number of days in a month

Uses the daysInMonth function to determine the number of days in a month

<cfset Date = CreateDate(2012, 12, 30)>
<cfset result = daysInMonth(Date)>
<cfoutput>#result#</cfoutput>

Expected Result: 31


Simple example

To determine the number of days in a month

<cfset Date = CreateDate(2012, 02, 03)>
<cfset result = daysInMonth(Date)>
<cfoutput>#result#</cfoutput>

Expected Result: 29


Fork me on GitHub