I hunted around for this until I found a solution in the mailing list archives. Here's a suggested faq entry (and I second a request I saw to add date support to the new query mechanism).

---- snip

Q: How can I report based on time information, e.g. using the changetime field?

A:

The changetime field is stored as a string. To process comparisons, you need to use the strftime function provided in SQLLite. A full description can be found here:
http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions

In essence, you use a format of:

strftime("%s", modifier, modifier, ...)

So, for example, to find all tickets modified in the past 7 days, you could use a where clause of

   WHERE changetime > (select strftime ("%%s", "now", "-7 days"))

Note the use of the double %% as the first % is interpreted by Python and dissappears somewhere (this will likely get fixed).

The modifiers are very flexible - with some experimentation you'll be able to find exactly what you need.

---- snip

cheers, michael
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to