Hi Steve,

Nice to see you're working reasonable hours! Interesting UDF, thought I'd
try the challenge:

function WeekOfMonth(date) {

CurrentWeek=IncrementValue(DateDiff("ww",CreateDate(Year(date),Month(date),1
),DateAdd("d",8-DayofWeek(date),date)));
 return CurrentWeek;
 }

It's a bit clearer when expanded:

function WeekOfMonth(date) {
// Get the first of month
 FirstofMonth=CreateDate(Year(date),Month(date),1);
// Get the end of current week
 EndofWeek=DateAdd("d",8-DayofWeek(date),date);
// Count the Sundays between the two
 CurrentWeek=IncrementValue(DateDiff("ww",FirstofMonth,EndofWeek));
 return CurrentWeek;
 }

Cheers,

Ben


"Steve Onnis" <[EMAIL PROTECTED]> wrote in message news:23171@cfaussie...

> Am CERTAIN this one works properly:P




---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to