If you are on CF7, you can use cfform/cfinput to make sure they are entering 
a valid time value.

<cfform>
<cfinput name="timefield1" required="yes" validate="time" message="You must 
enter a time in format hh:mm:ss">
<cfinput name="timefield2" required="yes" validate="time" message="You must 
enter a time in format hh:mm:ss">
</cfform>

Then...
<cfoutput>#DateDiff(form.timefield1,form.timefield2, 
[precision])#</cfoutput>

Note that DateDiff returns a date/time value rather than an integer value, 
this threw me off for a while recently.

-- Josh




----- Original Message ----- 
From: "Eric Lackey" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Monday, February 27, 2006 10:39 AM
Subject: RE: Time Calculations


> As long as it's a valid date/time object, ColdFusion can give you the
> difference.
>
> <cfset dteThen = "2005-12-01 12:30:00"/>
> <cfoutput>
> The number of seconds since then is #DateDiff('s',now(),dteThen)#
> </cfoutput>
>
>
> -----Original Message-----
> From: Love Sponge [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 27, 2006 11:37 AM
> To: CF-Talk
> Subject: Re: Time Calculations
>
> I know DateDiff would work in many cases but here the user is inputting
> the time.  How do you get datediff to recognize the user inputted time?
>
>>I think you probably looking for the DateDiff function.  You can pass
> in
>>two date/time objects and get the difference in days, hours, minutes,
>>seconds, or whichever you prefer.
>>
>>http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/com
> m
>>on/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000440.htm
>>
>>
>>
>>-----Original Message-----
>>From: Love Sponge [mailto:[EMAIL PROTECTED]
>>Sent: Monday, February 27, 2006 11:29 AM
>>To: CF-Talk
>>Subject: Re: Time Calculations
>>
>>Could you be a bit more specific, getTickCount()seem to be ignoring the
>>time I entered as start and end times I entered for testing.  Could it
>>be using system time instead?
>>
>>(StartTime,
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233565
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to