Select Records 90 days from Current Date using DAY and MONTH

14586
10
10-18-2018 11:40 PM
timdunlevie1
New Contributor II

Hi all,

I have a feature class in a fgdb (ArcMap 10.6) and I want to add a definition query which shows me records that have a 'Start_Date' within 90 days of the current date.

The issue I have is that the Date field (DD/MM/YYYY) I am using, I can only use the DD/MM portion of this field as the year part is not a future year date.

For example:

ID, Start_Date

1, 02/11/2015

2, 10/12/2001

3, 10/01/2011

Is there a way to use the day & month of the "Start_Date" field to determine  if the Start_Date is within 90 days of today's date or Current Date.

My filter so far is this:

(EXTRACT(MONTH FROM Start_Date) >= EXTRACT(MONTH FROM CURRENT_DATE)) and (EXTRACT(MONTH FROM Start_Date) <= EXTRACT(MONTH FROM CURRENT_DATE)+3)

This is using the MONTH field, and it works to a degree, but is not quite precise.

It also has a problem with dates that fall in January as those records are not selected by add +3 from current month (10).

Can you combine EXTRACT(DAY....) AND EXTRACT(MONTH...) in the same query? I've been trying but keep getting a syntax error.

thanks

0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

instead of using 'now', you would substitute a different value in for it... the logic would still apply

0 Kudos