Sorry, I didn't realize that I was being terse; I apologize if I was coming across as condescending or insulting.
Yes, I have looked at the custom functions at Brian Dunning's site, and a couple of others but did not find what I wanted.
To clarify, if I have 2 dates defining some period, I want the number of whole months plus the number of non-whole month days. A whole month being defined as day one of a month through the last day of that month. So, the 15th of one month to the 15th of the next month would not be any whole months.
If the first day of the first month in the given range is not the first of that month, then that first month is not a whole month. If the last day of the last monthe in the given range is not the last of that month, then it is not a whole month.
For example, If date1 is Jan 5, 2013 and date2 is Apr 2, 2013, then that would be 2 whole months plus 28 days (Jan 31 - Jan 5 + Apr 2 - Apr 0)
Trying to clarify this and be explicit has led me to coming up with a possible solution. I think the following will get me what I need, did I miss something?
Let (
[
// if Invoice Start is the first day of the month, use that; else use first day of the next month
~start = Contacts::Invoice Start ;
~start =
If (
Day ( ~start ) = 1 ;
~start ;
Date ( Month ( ~start ) + 1 ; 1 ; Year ( ~start ) )
) ;
// if Invoice End is the last day of the month, use that; else use last day of previous month
~end = Contacts::Invoice End ;
~end =
If (
Day ( Date ( Month ( ~end ) + 1 ; 0 ; Year ( ~end ) ) ) = Day ( ~end ) ;
~end ;
Date ( Month ( ~end ) ; 0 ; Year ( ~end ) )
) ;
// number of whole months
~months = Month ( ~end ) - Month ( ~start ) ;
// number of non-whole month days
~days = ( ~start - Contacts::Invoice Start ) + ( Contacts::Invoice End - ~end )
] ;
( Summary Total Weight * ~months * Invoice Rate ) +
( Summary Total Weight * ~days * Invoice Daily Rate ) +
Summary Total Shipping - Summary Total Discount
)