weekends = 0
weekdays = 0
loop i from date1 to date2
     if DayOfWeek(i) == 1 or 7
          weekends++
     else
          weekdays++
     end-if
end-loop




                                                                                       
                                     
                    Mark Smyth                                                         
                                     
                    <[EMAIL PROTECTED]        To:     "'[EMAIL PROTECTED]'" <[EMAIL 
PROTECTED]>     
                    oup.co.uk>                    cc:                                  
                                     
                                                  Subject:     [ cf-dev ] Calculate 
business days only within date range    
                    07/06/2004 12:14                                                   
                                     
                    Please respond to dev                                              
                                     
                                                                                       
                                     
                                                                                       
                                     



Hi Guys


I have 2 dates and am doing a datediff to get the days between the two.


<cfset date1 = "2004-06-07 00:00:00">
<cfset date2 = "2004-06-15 00:00:00">
<cfoutput>#DateDiff("d", "#date1#", "#Date2#")#</cfoutput>  gives me 8
But I want to also be able to calculate the business days only also (doing
the same as the above but excluding weekends).  I could've sworn I came
across a UDF or some which did this before, but have search on cflib with
no luck.


Anyone have anything handy?
Thanks
Mark








-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to