AnsweredAssumed Answered

Using dates in If statements

Question asked by GraysonSmith on Jun 8, 2015
Latest reply on Jun 8, 2015 by philmodjunk

Title

Using dates in If statements

Post

Hi!
 

I haven't worked too much with dates and what I need to do is have a calculation field return zero if the date of one field is less than a specified date. What I am trying to do is set a field to 0 if it is x years before this current year.

 

Example:


If( Assets::DateIssued > 01/01/2010 ; 0 ; 1 )

Obviously that's incorrect formatting, but I hope I'm relatively clear with what I'm asking about.

 

EDIT:
I tried a workaround to make a field with todays date named Assets::DateToday with an auto-calc of Get(CurrentDate). Then I made the field in question a calc field with the following:

If( Year(Assets::DateToday) - Year (Assets::DatePurchased) > Assets::YearSpread ; 0 ; 1 )

 

The above is not functioning correctly even though I believe it should work. Help?

Outcomes