Skip to main content
Solved

Test Filter Date Calculation

  • May 7, 2019
  • 1 reply
  • 112 views

When using Test filter, how do I capture todays date -65?

SQL Statement would read "Field_1" >=(GetDate()-65)

Best answer by chrisatsafe

Hi @sigmadon_max,

If you want to use a Date/Time Function for the right value of the Tester, you will want to set the right value to something like:

@DateTimeAdd(@DateTimeFormat(@DateTimeNow(),%Y%m%d),-P65D)

Note: you will want the dates to be formatted the same so you may not necessarily use %Y%m%d.

The Date/Time Functions documentation will be an excellent resource to learn more about formatting, etc.

Alternatively, you can use something like the DateTimeStamper to create a new attribute for today's date, followed by a DateTimeCalculator to subtract 65 days (and a DateTimeConverter to format it accordingly). Then, simply set the right value of the Tester to the newly created date attribute - you can remove this attribute after testing.

Hope this helps!

View original
Did this help you find an answer to your question?

1 reply

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • Best Answer
  • May 7, 2019

Hi @sigmadon_max,

If you want to use a Date/Time Function for the right value of the Tester, you will want to set the right value to something like:

@DateTimeAdd(@DateTimeFormat(@DateTimeNow(),%Y%m%d),-P65D)

Note: you will want the dates to be formatted the same so you may not necessarily use %Y%m%d.

The Date/Time Functions documentation will be an excellent resource to learn more about formatting, etc.

Alternatively, you can use something like the DateTimeStamper to create a new attribute for today's date, followed by a DateTimeCalculator to subtract 65 days (and a DateTimeConverter to format it accordingly). Then, simply set the right value of the Tester to the newly created date attribute - you can remove this attribute after testing.

Hope this helps!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings