Do you only want to prorate by month?  If I understand your question, you
can do it pretty easy down to the day.  Look at the DayofYear() function.
Something like this should work:

CFSCRIPT

if(IsLeapYear(Year(HireDate))) {
        daysInYear = 366;
}else{
        daysInYear = 365;
}

YearPartEmployed = (daysInYear-DayofYear(HireDate))/daysInYear;

/CFSCRIPT

-Cameron

--------------------
Cameron Childress
elliptIQ Inc.
p.770.460.1035.232
f.770.460.0963
--
http://www.neighborware.com
America's Leading Community Network Software





> -----Original Message-----
> From: David D <[EMAIL PROTECTED]> [mailto:David D
> <[EMAIL PROTECTED]>]
> Sent: Friday, January 04, 2002 10:33 AM
> To: CF-Talk
> Subject: CF Prorating Based Date Expression
>
>
> Hello,
>
> I am looking to calculate based on the HireDate vs. the YearBegin Date.
>
> Ex: employee was hired 1/1/2002 which is YearBegin Date and shall
> therefore
> be calculated at 12/12 or 100%.
>
> Ex2: employee was hired on 2/1/2002 versus YearBegin of 1/1/2002 and
> therefore calculations should be based on 11/12 or 91.6%
>
> Example 3 (where it gets hairy or at least hairier): is where
> employee was
> hired on 2/2/2002 and therefore should calculate at 10/12 since he wasn't
> there for the 1st.
>
> I was trying to use DateCompare() and then saw DateDiff() but they don's
> seem to differentiate between another month based on the day not
> being the
> first, ie. DateDiff is saying that 2/1/2002 is 1 month past
> 1/1/2002 and it
> also says that 2/2/2002 is also 1 month past, instead of 2.
>
> Any ideas on to how I should proceed with this would be greatly
> appreciated.
>
> Thanks,
>
> Dave
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.

______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to