If you are storing the contract start and end dates in separate date fields, a simple subtraction can compute the number of days.
ContractEndDateField - Date ( 1 ; 1 ; 2010 ) will work.
If you want this for number of days in the current year, use:
ContractEndDateField - Date ( 1 ; 1 ; Year ( Get ( CurrentDate ) )
This works because date fields are really just specially formatted number fields that record the dates as the number of days since December 31, 0000
I do have start and end dates in separate fields . I think I am beingpretty dense as I am having a hard time getting this to work .
When I try the second formula as follows
ExpirationdateforIHS-Date ( 1 ; 1 ; 2010(Get(CurrentDate))
It tells me an operator is expected here (Get
You should be using either:
ContractEndDateField - Date ( 1 ; 1 ; 2010 ) if you always want the days from January first of 2010
or you should use:
ContractEndDateField - Date ( 1 ; 1 ; Year ( Get ( CurrentDate ) ) if you want the days from January first of this year.
You appear to have combined the two examples that's resulting in incorrect syntax and an error message.
> how many days a contract has to run within a specific year.
How do you select the "specific year"? Is it always the current year?
Note that a contract can be entirely within the specified year, partially overlapping the year (front or back) or not at all - IOW you need to base your calculation on four dates.
I don't think I am explaining this very well so my apologies.
It would always be with the current year but at different times of the year. for example as of 7/21/2010 how may days remain on the contract that was effective 12/1/2009. The contracts are always 12 months long.
Thanks for your help
Thanks for pointing that out.
Perhaps this will serve:
Let ( [ d1 = Max ( ContractStartDate ; Date ( 1 ; 1 ; Year ( get ( CurrentYear ) ) ) ;
d2 = Min ( ContractEndDate ; Date ( 12 ; 31 ; Year ( get ( CurrentYear ) )) ] ;
d2 - d1
So its really three dates I guess.
A:Start of the year
B:days remaining as specified date
C:contract expiration date (which could be before or after B)
Thanks PhilModjunk I wil give that a try