User Guide
Chapter 2: ColdFusion Functions 395
IsLeapYear
Returns TRUE if the year is a leap year; otherwise, FALSE.
See also DaysInYear.
Syntax IsLeapYear(
year
)
year
Number representing the year.
Examples <!--- This example shows the use of IsLeapYear --->
<HTML>
<HEAD>
<TITLE>
IsLeapYear Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<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" METHOD="POST">
<P>Enter a year value, and find out if it is a valid Leap Year.
<P><INPUT TYPE="Text" NAME="TheTestValue"
VALUE="<CFOUTPUT>#Year(Now())#</CFOUTPUT>">
<INPUT TYPE="Submit" VALUE="Is it a Leap Year?" NAME="">
</FORM>
</BODY>
</HTML>