<!--- This example shows how to createTimeSpan --->
<HTML>

<HEAD>
<TITLE>
CreateTimeSpan Example
</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<H3>CreateTimeSpan Example</H3>

<CFIF IsDefined("form.year")>

<!--- set variables for the date and for the time span --->
<CFSET yourDate = CreateDateTime(form.year,form.month,form.day, form.hour,form.minute,form.second)>
<CFSET yourTimeSpan = CreateTimeSpan(form.tsday,form.tshour,form.tsminute,form.tssecond)>

<CFOUTPUT>
<P>Your original date value: #yourDate#
<P>The date of your timespan, formatted:

<!--- output the results of the form --->
<P>#yourTimeSpan# days <CFIF yourTimeSpan LTE 0>before your<CFELSE>after your</CFIF> original date:
<BR>#DateFormat(yourDate + yourTimeSpan)#
 #TimeFormat(yourDate + yourTimeSpan)#

</CFOUTPUT>

</CFIF>


<CFFORM ACTION="createtimespan.cfm" METHOD="POST">
<P>Please enter the year, month and day in integer format for 
the date value you would like to view:
<PRE>
Year	<CFINPUT TYPE="Text" NAME="year" VALUE="1998" VALIDATE="integer" REQUIRED="Yes">
Month	<CFINPUT TYPE="Text" NAME="month" VALUE="6" RANGE="1,12" MESSAGE="Please enter a month (1-12)" VALIDATE="integer" REQUIRED="Yes">
Day	<CFINPUT TYPE="Text" NAME="day" VALUE="8" RANGE="1,31" MESSAGE="Please enter a day of the month (1-31)" VALIDATE="integer" REQUIRED="Yes">
Hour	<CFINPUT TYPE="Text" NAME="hour" VALUE="16" RANGE="0,23" MESSAGE="You must enter an hour (0-23)" VALIDATE="integer" REQUIRED="Yes">
Minute	<CFINPUT TYPE="Text" NAME="minute" VALUE="12" RANGE="0,59" MESSAGE="You must enter a minute value (0-59)" VALIDATE="integer" REQUIRED="Yes">
Second	<CFINPUT TYPE="Text" NAME="second" VALUE="0" RANGE="0,59" MESSAGE="You must enter a value for seconds (0-59)" VALIDATE="integer" REQUIRED="Yes">

The time span you'd like to show
Day	<CFINPUT TYPE="Text" NAME="tsday" VALUE="16" VALIDATE="integer" MESSAGE="You must enter a value for the number of days in advance" REQUIRED="Yes">
Hour	<CFINPUT TYPE="Text" NAME="tshour" VALUE="16" MESSAGE="You must enter a value for the number of hours" VALIDATE="integer" REQUIRED="Yes">
Minute	<CFINPUT TYPE="Text" NAME="tsminute" VALUE="12" MESSAGE="You must enter a value for the number of minutes" VALIDATE="integer" REQUIRED="Yes">
Second	<CFINPUT TYPE="Text" NAME="tssecond" VALUE="0" MESSAGE="You must enter a value for the number of seconds" VALIDATE="integer" REQUIRED="Yes">

</PRE>
<P><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">


</CFFORM>



</BODY>

</HTML>       
