CreateTime

Returns a valid time variable in ColdFusion.

See also CreateODBCTime and CreateDateTime.

Syntax

CreateTime(hour, minute, second)
hour

Number representing the hour, ranging from 0 to 23.

minute

Number representing the minute, ranging from 0 to 59.

second

Number representing the second, ranging from 0 to 59.

Usage

CreateTime is a subset of CreateDateTime.

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

Examples

<!--- 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>

<FORM action="createtime.cfm" METHOD="post">
<INPUT TYPE="hidden" NAME="hour_Required">
<INPUT TYPE="hidden" NAME="minute_Required">
<INPUT TYPE="hidden" NAME="second_Required">
<INPUT TYPE="hidden" NAME="hour_Range" Value="Min=1 Max=24">
<INPUT TYPE="hidden" NAME="minute_Range" Value="Min=1 Max=60">
<INPUT TYPE="hidden" NAME="second_Range" Value="Min=0 Max=60">
<PRE>
Hour    <INPUT TYPE="Text" NAME="hour" VALUE="16">
Minute    <INPUT TYPE="Text" NAME="minute" VALUE="12">
Second    <INPUT TYPE="Text" NAME="second" VALUE="0">
</PRE>
<P><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">
</FORM>
</BODY>
</HTML>