Example Number 4.9

Example Name: DebugFunctions2.cfc

Language: CFML

Version: 1.0.0

Code:

<cfcomponent>
  <cffunction name="computeTimeDifference" access="remote">
    <cfscript>
    myObject = CreateObject("java", "flashgateway.io.ASObject");
    t = myObject.init();
    t.setType("TimeDifferenceClass");
    d = now();
    e = createodbcdatetime(arguments.date);
    difference = DateDiff("s", d, e);
    days = int(difference/60/60/24);
    difference = difference - days*60*60*24;
    hours = int(difference/60/60);
    difference = difference - hours*60*60;
    minutes = int(difference/60);
    seconds = difference - minutes*60;
    t.put("days",#days#);
    t.put("hours",#hours#);
    t.put("minutes",#minutes#);
    t.put("seconds",#seconds#);
    t.put("inited",arguments.inited);
    return t;
    </cfscript>
  </cffunction>
</cfcomponent>

Download code text

Download chapter example files