ColdFusion Date Math Faster Than Date Methods... And Other Date/Math Ramblings

<!--- Test the DateAdd() method. --->
<cftimer label="Date Methods" type="outline">
	 
	<!--- Get current date. --->
	<cfset dtNow = Now() />
	 
	<!--- Loop for time testing. --->
	<cfloop index="intI" from="1" to="10000" step="1">
		 
		<!--- Get a new date. --->
		<cfset dtNewDay = DateAdd( "d", -intI, dtNow ) />
	 
	</cfloop>
	 
	<!--- Output for feedback. --->
	#DateFormat( dtNewDay )#
 
</cftimer>
 
 
<!--- Test the fractional math method. --->
<cftimer label="Date Math" type="outline">
	 
	<!--- Get current date. --->
	<cfset dtNow = Now() />
	 
	<!--- Loop for time testing. --->
	<cfloop index="intI" from="1" to="10000" step="1">
		 
		<!--- Get a new date. --->
		<cfset dtNewDay = (dtNow - intI) />
	 
	</cfloop>
	 
	<!--- Output for feedback. --->
	#DateFormat( dtNewDay )#
 
</cftimer>

For Cut-and-Paste