createTimespan
Returns a value that defines a time period, represented by a numeric (double) where 1 equals 1 day. You can add or subtract it from other date/time objects and use it with the cachedWithin attribute of cfquery.
createTimespan(days, hours, minutes, seconds) → returns numeric
Argument Reference
days numeric Required
The number of days ranging from 0 to 32768
hours numeric Required
The number of hours
minutes numeric Required
The number of minutes
seconds numeric Required
The number of seconds
Examples Sample code invoking the createTimespan function
The createTimespan function is useful in the cachedwithin attribute of cfquery.
<cfquery name = "GetParks" datasource = "cfdocexamples" cachedWithin = "#createTimespan(0, 6, 0, 0)#">
SELECT PARKNAME, REGION, STATE
FROM Parks
ORDER by ParkName, State
</cfquery> Instead of using dateAdd you could add a timestamp to a date object
dateFormat( createDate(2017,1,1) + createTimespan(2,0,0,0) ) Expected Result: 03-Jan-17
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/createtimespan