> I was thinking that the function could function when the arguments are 
> essentially the same day.

I'm a little confused.  The dateDiff() function DOES work when the
arguments are the same day.  Have we led you to believe otherwise, or
are you talking about a different "function" functioning?

> Here's what I did to solve the problem: when the function returns 0, do this:

Exactly what combination of inputs to dateDiff() is returning zero? If
it is your second example in your original post, then it SHOULD return
zero because the two dates were less than one minute apart.  Your code
below is asking whether or not the two times are in the same "hour" and
"minute" which is a different question than asking how many full hours
and minutes exists between the times.  (It's also worth noting your code
below will ONLY work for times on the same day and with a 24 hour clock)

If your objective is to decide if the times are in the same "minute"
then you should probably always be using datePart() starting with the
largest unit (year) and working in and NOT using dateDiff() at all. 
Alternatively you could continue to use dateDiff() to the second level,
divide by 60, and "ceiling()" the result up to the next full minute
which is essentially what you are doing below.

Perhaps you can explain exactly what you were trying to do.

~Brad

<cfoutput>
<cfset holdTotalHours = ABS(DatePart("h", arguments.HighDate) -
DatePart("h", arguments.LowDate))>

<cfset holdTotalMinutes = ABS(DatePart("n", arguments.HighDate) -
DatePart("n", arguments.LowDate))

Results in (HH:MM) Format: #holdTotalHours#:#holdTotalMinutes#
</cfoutput>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332864
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to