Datediff

Usage 
To find the number of days between date1 and date2, use Day of Year or Day. 

When datepart is Weekday, DateDiff returns the number of weeks between the two dates. 
If date1 falls on a Monday, DateDiff counts the number of Mondays to date2. It counts 
date2 but not date1. 

*************************
If interval is Week, however, DateDiff returns the number of calendar weeks between 
the two dates. It counts the number of Sundays between date1 and date2. DateDiff 
counts date2 if it falls on a Sunday; but it doesn't count date1, even if it falls on 
a Sunday. 
*************************

It is working exactly as designed. (Why is a different question)

Jerry Johnson


>>> [EMAIL PROTECTED] 08/19/03 04:13PM >>>
Platform: CF5/Win2K/IIS5

I'm seeing wierd results from DateDiff when using 'ww' (weeks) as the date part.  Can 
anyone explain these results?

<CFSET d1 = "08/3/2003">
<CFSET d2 = "08/10/2003">
<CFOUTPUT>
        <P>#DateDiff('ww',d1,d2)#
        <!--- Result: 1 --->
</CFOUTPUT>

<CFSET d1 = "08/4/2003">
<CFSET d2 = "08/11/2003">
<CFOUTPUT>
        <P>#DateDiff('ww',d1,d2)#
        <!--- Result: 0 --->
</CFOUTPUT>

To me, these should both be 1 week.

<CFSET d1 = "1/1/2003">
<CFSET d2 = "1/11/2003">
<CFOUTPUT>
        <P>#DateDiff('ww',d1,d2)#
        <!--- Result: 0 --->
</CFOUTPUT>

<CFSET d1 = "1/1/2003">
<CFSET d2 = "1/12/2003">
<CFOUTPUT>
        <P>#DateDiff('ww',d1,d2)#
        <!--- Result: 1 --->
</CFOUTPUT>

I don't know *what* this means.  I thought maybe it was based on ordinal weeks, but it 
doesn't seem to be.  Is this expected behavior?

Thanks,
Chris

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to