Skip navigation.

Creating your first Coldfusion Component Step 1

Coldfusion Components (CFC)

(1) All CFC's have the .cfc extension

Coldfusion Components usually contain one or more functions/methods.

Function: a block of code that performs an operation & usually returns a result. Tag <cffunction> </cffunction>

This tag has several attributes BUT only 2 are really important.

(1) name: your name of the function. This has to be unique for your component. You can reuse the name in a diffrent component.

(2) returntype: basically the results you would like returned. String, Date, Array, Query etc...



<cffunction name="today" returntype="date">


<!-- Get Tomamrows Date -->

<cffunction name="tommarow" returntype="date">


<!-- Get yesterday date-->

<cffunction name="yesterday" returntype="date">