CreateTime

Description

Returns a time variable in ColdFusion.

Category

Date and time functions

Syntax

CreateTime(hour, minute, second) 

See also

CreateODBCTime, CreateDateTime

Parameters

Parameter
Description
hour
Number in the range 0-23
minute
Number in the range 0-59
second
Number in the range 0-59

Usage

CreateTime is a subset of CreateDateTime.

Time variables are special cases of date/time variables. The date part of a time variable is set to December 30, 1899.

Example

<!--- This code illustrates CreateTime and CreateODBCTime --->
<html>
<head>
<title>CreateTime Example</title>
</head>
<basefont face = "Arial, Helvetica" size = 2>
<body bgcolor = "#FFFFD5">
<H3>CreateTime Example</H3>
<cfif IsDefined("FORM.hour")>
Your time value, presented using different CF time functions:
<cfset yourTime = CreateTime(FORM.hour, FORM.minute, FORM.second)>
<cfoutput>
<UL>
  <LI>Built with CreateTime: #TimeFormat(yourTime)#
  <LI>Built with CreateODBCTime: #CreateODBCTime(yourTime)#
</UL>
<P>The same value can be formatted with timeFormat:
<UL>
  <LI>Built with CreateTime: #TimeFormat(yourTime, 'hh:mm:ss')#
  <LI>Built with CreateODBCTime: 
  #TimeFormat(yourTime, 'hh:mm:sstt')#
</UL>  
</cfoutput>
</cfif>
</body>
</html>