Adobe ColdFusion 8

IsLeapYear

Description

Determines whether a year is a leap year.

Returns

True, if year is a leap year; False, otherwise.

Category

Date and time functions, Decision functions

Function syntax

IsLeapYear(year)

See also

DaysInYear

Parameters

Parameter

Description

year

Number representing a year

Example

<h3>IsLeapYear Example</h3>

<cfif IsDefined("FORM.theTestValue")>
    <cfif IsLeapYear(FORM.theTestValue)>
        <h3>The year value <cfoutput>#DE(FORM.theTestValue)#</cfoutput> is a Leap Year</h3>
    <cfelse>
        <h3>The year value <cfoutput>#DE(FORM.theTestValue)#</cfoutput> is not a Leap Year</h3>
    </cfif>
</cfif>

<form action = "isLeapYear.cfm">
<p>Enter a year value, and find out whether it is a Leap Year.
<p><input type = "Text" name = "TheTestValue" value = "
    <cfoutput>#Year(Now())#</cfoutput>">
<input type = "Submit" value = "Is it a Leap Year?" name = "">
</form>