Simple date arithmetic

(John Masters) #1

Attempting to get my head round Tinderbox for about the fifth time.

Trying to set a query to get all notes with a DueDate in the next seven days. This should be easy but is beyond me. Started off with $DueDate>date(“Today”)&$DueDate<date(“Today”+“7 Days”) and tried variations on this theme. Cannot find anything in the Help or online.

About to give up for the fifth time.


(James Fallows) #2

Try getting rid of the quotes around “Today” and “7 days”

I have this expression in a “Due Items” query, and it works fine:


Good luck!

Update: just tested using $DueDate<date(today + 7 days) and that also worked fine. I think it’s the quotes.

(John Masters) #3

Thanks, that works. I put the quotes in because the screencast I watched used quotes for $DueDate==date(“Today”).

(James Fallows) #4

Phew! Glad it worked.

(eastgate) #5

The date() operator takes a string and converts it to a date.

date(“today+7 days”)

In your case, evaluating “Today”+“7 Days” gives a result of “Today7 Days”, which Tinderbox can’t understand.

Suggestion: When puzzled by a date query like this, make a new Tinderbox file with a few notes. Select one, and make MyDate a key attribute. Type your date expression-- whatever text you’re feeding to date() – into the key attribute field.

Suggestion: When puzzled, ask here. You’re likely to get good advice on puzzles like this one, often very quickly.