Don't worry, just created my own UDF to do the job, and isn't calculating
easter a pain in the a***!

For those who want it I have included it here.

NOTE: This calculates working days in the UK, anywhere else you will have to
adjust the bank holidays.

<cfscript>
/* This UDF is based on an excell macro found at 
   http://www.shopperlabs.com/upload/database/excel_macro.txt

   with help calculating easter from
   1) http://www.assa.org.au/edm.html#Computer
   2) http://henk-reints.nl/easter/index.htm

   James Smith ([EMAIL PROTECTED]) 
   version 1, {ts '2004-12-07 12:00:00'} */

function workingDaysInMonth(thisMonth) {

  var finalVal = 0;
  var adjustment = 0;
  var startDate = createDate(year(thisMonth),month(thisMonth),1);
  var startDay = dayOfWeek(startDate);
  var startMonth = month(startDate);
  var startYear = year(startDate);
  
  totalDaysInMonth = daysinmonth(thisMonth);
  workingDaysInMonth = listgetat("22,23,23,23,22,21,21",startDay); /* Based
on 31 day month */

  /* Adjust for 30 day month */
  if (totalDaysInMonth IS 30) workingDaysInMonth = workingDaysInMonth - 1;

  /* Special Cases */
  /* February */
  if (totalDaysInMonth IS 28) workingDaysInMonth = 20;
  /* Leap Year */
  if ((startYear mod 4 IS 0) AND (startMonth IS 2)) adjustment = adjustment
+ 1;
  /* New Years Day */
  if  (startMonth IS 1) adjustment = adjustment - 1;
  /* Christmas Day & Boxing Day */
  if  (startMonth IS 12) adjustment = adjustment - 2;
  /* May Bank Holidays (First and last Monday) */
  if  (startMonth IS 5) adjustment = adjustment - 2;
  /* August Bank Holiday */
  if  (startMonth IS 8) adjustment = adjustment - 1;
  /* Easter */
  A = startYear MOD 19 + 1;
  B = int(startYear / 100) + 1;
  C = int((3 * B) / 4) - 12;
  D = int((8 * B + 5) / 25) - 5;
  E = int((startYear * 5) / 4) - 10 - C;
  F = ((11 * A + 20 + D - C) MOD 30 + 30) MOD 30; /* the double MOD prevents
F to go below zero for large years */
  if ((F IS 24) or (F IS 25 and A GT 11)) F = F + 1;
  G = 44 - F;
  if (G LT 21) G = G + 30;
  dayInMarch = G + 7 - (E + G) MOD 7;
  if (dayInMarch LTE 31) {
    easterSunday = createDate(startYear,3,dayInMarch);
  } else {
    dayInMarch = dayInMarch -31;
    easterSunday = createDate(startYear,4,dayInMarch);
  }
  easterMonday = dateadd("d",+1,easterSunday);
  goodFriday = dateadd("d",-2,easterSunday);
  if (startMonth IS month(easterMonday)) adjustment = adjustment - 1;
  if (startMonth IS month(goodFriday)) adjustment = adjustment - 1;

  /* Return Result */
  finalVal = workingDaysInMonth + adjustment;
  return finalVal;

}

</cfscript>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - New Atlanta
http://www.newatlanta.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186430
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to