Whatever message this page gives is out now! Go check it out!

CreateTimeSpan

Last update:
May 18, 2026

Description

Creates a date-time object (Java Double). You can add or subtract it from other date-time objects and use it with the cachedWithin attribute of cfquery.

Returns

A date-time object (Java Double).

Category

Function syntax

CreateTimeSpan(days, hours, minutes, seconds)

See also

CreateDateTimeDateAddDateConvertDefining application-level settings and variables in Defining the application and its event handlers in Application.cfc in the Developing ColdFusion Applications

Parameters

Parameter
Description
days
Integer in the range 0-32768; number of days in time period
hours
Number of hours in time period
minutes
Number of minutes in time period
seconds
Number of seconds in time period

Usage

Creates a date-time object (Java Double) that should be used only to add and subtract from other date-time objects or with the cfquery cachedWithin attribute.If you use the cachedWithin attribute of cfquery, and the original query date falls within the time span you define, cached query data is used. In this case, the CreateTimeSpan function is used to define a period of time from the present backwards. The cachedWithin attribute takes effect only if you enable query caching in the ColdFusion Administrator. For more information, see cfquery.

Example

<cfscript>
    hours = 10;
    minutes= 09;
    seconds= 46;
    days = 12;
    myTime=CreateTimeSpan(days,hours,minutes,seconds)
    writeOutput("Time is : " & myTime)
</cfscript>
Output
TimeSpan is : 12.4234490741

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page