Access Keys:
Skip to content (Access Key - 0)

Q: How do I do a relative date search in Reqest Tracker?

Context

  • MIT's Request Tracker (RT) instance on help.mit.edu
  • Should also apply to other Request Tracker installations
  • Applies to analysts/consultants working on RT queues
  • Does not apply to clients simply using RT to see their tickets
  • You should be familiar with using RT's Query Builder to construct a query

Answer

Sometimes you want to do a relative date search, or search back a period of time from now rather than always limiting your search by specific dates.

Examples why you might want to do this

  • Search through the last 30 days worth of tickets and re-use the same search to always get the last 30 days
  • Construct a daily or weekly report as a saved search
  • Look back N days without having to work out what date that was

RT's relative date syntax

You can use the following syntax instead of explicit dates in the date box when you use Query Build or in your query string if you use the Advanced search interface to type in your query directly. You can also use these forms to set dates in RT date boxes on a ticket screen, for example to make a ticket due 7 days from now, to set the "starts" date to two weeks from today, or to indicate that it took you 2 days to work on a ticket.

count days "count" is an integer. You would use this to indicate a duration, for example in a "time worked" field. You would not use it in searching except as part of a more complicated expression doing arithmetic.
count weeks Same idea, but for weeks.
count months You may begin to see a pattern...
count years How many years did you work on this ticket?
dow after next "dow" stands for "day of the week". You might use this to indicate a future point in time. For example you might use this to set the "starts" date of a ticket to the "monday after next"
dow Just day of the week. Avoid this if possible as it relies on a global server setting specifying whether to interpret this as the the closest past day of the week, or the closest next day of the week. Use next dow instead.
next dow The next specified day of the week.
today Today's date. Note that RT does not seem to do GMT conversion correctly, so "today" actually turns over around 7PM EST.
tomorrow Tomorrow, with the GMT caveat.
yesterday Yesterday's date. Same GMT issue, so it's really yesterday's span from 7PM EST the day before until 7PM EST yesterday.
last dow "dow" stands for "day of the week". You would most likely use this with the < or > operators, for example to pull up all tickets created after last Monday.
last week Any date last week
now Now. Usually only used as part of a more complicated date expression, otherwise you'll have very few matches, if any.
now + count units "count" is an interger and "units" is something like "days" or "weeks". For example now + 2 days means exactly 48 hours from now.
now - count units Same as above but for dates in the past. To search for things created within the last 24 hours, for example, look for "Created > 'now - 1 day'"
+ count units Basically like saying "today + count units" where "count" is a number and "units" is "days", "weeks", etc. Unlike "now", "today" starts at the beginning of the day.
- count units Same as above, but for dates in the past. For example, searching for "Created > '-1 day'" is the same as searching for "Created = yesterday" (verify!)
count units ago Same as "today - count units"

Examples

Could use a few screen shots and examples here.

More information

This parsing is actually not done by RT itself. RT uses a Perl module called Time::ParseDate to do its date and time parsing. See the CPAN entry on Time::ParseDate for more information, including time formats and specifying time zones in absolute dates.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

February 25, 2009

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
request_tracker request_tracker Delete
rt rt Delete
searching searching Delete
c-rt-search c-rt-search Delete
c-rt-user c-rt-user Delete
c-rt-enduser-search c-rt-enduser-search Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki