<cfscript> // This time, let's use our User Defined Function (UDF) to do the same thing. This // just hides the complexity of the numeric dates. currentDate = now(); futureDate = dateAddTimeSpan( currentDate, createTimeSpan( 1, 1, 1, 1 ) ); pastDate = dateAddTimeSpan( currentDate, - createTimeSpan( 1, 1, 1, 1 ) ); echoLine( "Cur. Date:", currentDate ); echoLine( "Fut. Date:", futureDate ); echoLine( "--" ); echoLine( "Cur. Date:", currentDate ); echoLine( "Pas. Date:", pastDate ); // ------------------------------------------------------------------------------- // // ------------------------------------------------------------------------------- // /** * I add the given timespan (fractional number of numeric days) to the given date. */ public date function dateAddTimeSpan( required date input, required numeric timeSpan ) { // NOTE: I'm using the built-in functions, not the member methods, so that the // input date can be more flexible (such as being a numeric date). return( dateAdd( "s", fix( 86400 * timeSpan ), input ) ); } /** * I output all the simple arguments on to a line, followed by a line-break. */ public void function echoLine( required any value ) { writeOutput( arrayToList( arguments, " " ) & "<br />" ); } </cfscript>