Relative Dates in Search

Is there a way to specific a relative date in a search so that when saved it
will calculate off the current date? For example tickets from the past two
weeks but without having to adjust the date in the search?

Hi Stephen. I use some dashboard searches that work like this. I
usually calculate my searches from the ticket’s due date, but you
could use the “started” date or “created” or any other date you wanted.

To see things that are due today and were due any time in the past, I
use the following string in my search after setting other criteria:

AND ( Due = ‘today’ OR Due < ‘today’)

I also have another search that shows me things that aren’t due yet:

AND Due > ‘today’

If you are looking for more relative dates, I played around with this
format for a few minutes and it seemed to work:

AND ( Due < ‘today’ AND Due > ‘last week’ )

Let me know if it works for you.

It looks like you can get it down to 1 week in either direction, but I
don’t know how it would be adapted to show something like “two weeks
ago” or “the week before last week,” though. I tried putting those
phrases in the strings and the query didn’t return what I wanted.
Cassandra Phillips-Sears

Office Manager
Best Practical Solutions, LLC
http://www.bestpractical.comOn Feb 26, 2009, at 11:17 AM 2/26/09, Stephen Cochran wrote:

Is there a way to specific a relative date in a search so that when
saved it will calculate off the current date? For example tickets
from the past two weeks but without having to adjust the date in the
search?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

It looks like you can get it down to 1 week in either direction, but I
don’t know how it would be adapted to show something like “two weeks
ago” or “the week before last week,” though.

Use numerals instead of words for numbers.

% perl -MTime::ParseDate -le 'print for scalar localtime, scalar localtime Time::ParseDate::parsedate(“2 weeks ago”)'
Thu Feb 26 11:33:52 2009
Thu Feb 12 11:33:52 2009

hdp.

Hi Stephen. I think I’ve got it.

You can use + and - signs in front to increment the numbers of weeks,
months, etc.

So, if you want to see all tickets due in the past 2 weeks before
today, you’d add this to your search:

( Due < ‘today’ AND Due > ‘-2 week’ )

If you wanted to see all the tickets due today and coming up for the
next 2 weeks, you could try:
( Due = ‘today’ AND Due > ‘+2 week’ )

And so on and so forth.
Cassandra Phillips-Sears
cassandra@bestpractical.com

Office Manager
Best Practical Solutions, LLC
http://www.bestpractical.comOn Feb 26, 2009, at 11:36 AM 2/26/09, Cassandra Phillips-Sears wrote:

Hi Stephen. I use some dashboard searches that work like this. I
usually calculate my searches from the ticket’s due date, but you
could use the “started” date or “created” or any other date you
wanted.

To see things that are due today and were due any time in the past,
I use the following string in my search after setting other criteria:

AND ( Due = ‘today’ OR Due < ‘today’)

I also have another search that shows me things that aren’t due yet:

AND Due > ‘today’

If you are looking for more relative dates, I played around with
this format for a few minutes and it seemed to work:

AND ( Due < ‘today’ AND Due > ‘last week’ )

Let me know if it works for you.

It looks like you can get it down to 1 week in either direction, but
I don’t know how it would be adapted to show something like “two
weeks ago” or “the week before last week,” though. I tried putting
those phrases in the strings and the query didn’t return what I
wanted.

Cassandra Phillips-Sears

Office Manager
Best Practical Solutions, LLC
http://www.bestpractical.com

On Feb 26, 2009, at 11:17 AM 2/26/09, Stephen Cochran wrote:

Is there a way to specific a relative date in a search so that when
saved it will calculate off the current date? For example tickets
from the past two weeks but without having to adjust the date in
the search?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Thanks Hans!
Cassandra Phillips-Sears
cassandra@bestpractical.com

Office Manager
Best Practical Solutions, LLC
http://www.bestpractical.comOn Feb 26, 2009, at 11:34 AM 2/26/09, Hans Dieter Pearcey wrote:

On Thu, Feb 26, 2009 at 11:36:57AM -0500, Cassandra Phillips-Sears wrote:

It looks like you can get it down to 1 week in either direction,
but I
don’t know how it would be adapted to show something like “two weeks
ago” or “the week before last week,” though.

Use numerals instead of words for numbers.

% perl -MTime::ParseDate -le 'print for scalar localtime, scalar
localtime Time::ParseDate::parsedate(“2 weeks ago”)'
Thu Feb 26 11:33:52 2009
Thu Feb 12 11:33:52 2009

hdp.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com