but I'm guessing there's some use for that behavior.
I've looked at your function and it's close to what I'm looking for, but I
need to modify it to make it inclusive of the end dates.
----- Original Message -----
From: "Pascal Peters" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, June 05, 2004 2:14 AM
Subject: RE: Is this a DateDiff() bug?
> Not a bug, look in the help:
> "w" number of weeks between the two dates
> "ww" number of calendar weeks (Sundays) between the two dates
>
> The result between the two would differ if you have less than 7 days
> with a Sunday that doesn't fall on the first date.
>
> I think posted a function to return the number of weekdays (as you
> define it) on this list a few days ago:
>
> function WeekdaysBetween(date1,date2){
> var out = 0;
> var tmp = "";
> if(DateCompare(date1,date2) GT 0){
> tmp = date1;
> date1 = date2;
> date2 = tmp;
> }
> if(DayOfWeek(date1) IS 1) date1 = DateAdd("d",-2,date1);
> if(DayOfWeek(date1) IS 7) date1 = DateAdd("d",-1,date1);
> if(DayOfWeek(date2) IS 1) date2 = DateAdd("d",+1,date2);
> if(DayOfWeek(date2) IS 7) date2 = DateAdd("d",+2,date2);
> out = DateDiff("d",date1,date2);
> if(DayOfWeek(date2) LT DayOfWeek(date1)) out = out - 2;
> out = out - (out\7)*2;
> return out;
> }
>
> Pascal
>
> > -----Original Message-----
> > From: Jim McAtee [mailto:[EMAIL PROTECTED]
> > Sent: zaterdag 5 juni 2004 2:52
> > To: CF-Talk
> > Subject: Is this a DateDiff() bug?
> >
> > ColdFusion 5:
> >
> > <cfoutput>
> > <pre>
> > DateDiff("d", "5/1/2004", "5/31/2004") = #DateDiff("d",
> > "5/1/2004", "5/31/2004")# DateDiff("w", "5/1/2004",
> > "5/31/2004") = #DateDiff("w", "5/1/2004", "5/31/2004")#
> > DateDiff("ww", "5/1/2004", "5/31/2004") = #DateDiff("ww",
> > "5/1/2004", "5/31/2004")# </pre> </cfoutput>
> >
> > Gives:
> >
> > DateDiff("d", "5/1/2004", "5/31/2004") = 30 DateDiff("w",
> > "5/1/2004", "5/31/2004") = 4 DateDiff("ww", "5/1/2004",
> > "5/31/2004") = 4
> >
> > The docs state that "w" should return the number of
> > "Weekdays", which I take to mean the number days between the
> > two dates, minus days that fall on a weekend.
> >
> > By poking different dates into the two fields I can get the w
> > and ww results to differ by one, but most often they're the same.
> >
> > Bug?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

