Skip to main content
Solved

Test Filter Date Calculation

  • May 7, 2019
  • 1 reply
  • 134 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!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • 606 replies
  • 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!