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
Name | Type | Required | Default | Description |
---|---|---|---|---|
days | numeric | Yes | The number of days ranging from 0 to 32768 | |
hours | numeric | Yes | The number of hours | |
minutes | numeric | Yes | The number of minutes | |
seconds | numeric | Yes | The number of seconds |
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>
Passing 6 hours, or a quarter of a day returns a double representing 1/4
createTimespan(0, 6, 0, 0)
Instead of using dateAdd you could add a timestamp to a date object
dateFormat( createDate(2017,1,1) + createTimespan(2,0,0,0) )