You can use keywords relative to time in query expressions.
The following shows the valid keywords.
- Keyword
- Description
- %today_begin
- Beginning today, 00:00:00
- %today_end
- End of today, 23:59:59
- %this_week_begin
- End of this week, 23:59:59 )
See Note 1
- %this_week_end
- Beginning of last week, 00:00:00
See Note 1
- %last_week_begin
- Beginning of last week, 00:00:00
See Note 1
- %last_week_end
- Beginning of last week, 23:59:59
See Note 1
- %this_month_begin
- Beginning of this month, 00:00:00
- %this_month_end
- End of this month, 23:59:59
- %last_month_begin
- Beginning of last month, 00:00:00
- %last_month_end
- End of last month, 23:59:59
- %this_year_begin
- 1 Jan this year, 00:00:00
- %this_year_end
- 31 Dec this year, 23:59:59
- %today_minus<N>days
- Today minus <N> days, 00:00:00
- %today_plus<N>days
- Today plus <N> days, 00:00:00
- %today_minus<N>weeks
- Today minus <N> weeks, 00:00:00
- %today_plus<N>weeks
- Today plus <N> weeks, 00:00:00
- %today_minus<N>months
- Today minus <N> months, 00:00:00
See Note 2
- %today_plus<N>months
- Today plus <N> months, 00:00:00
See Note 2
- %today_minus<N>years
- Today minus <N> years, 00:00:00
See Note 3
- %today_plus<N>years
- Today plus <N> years, 00:00:00
See Note 3
Note: The first day of the week is Sunday by default. Set the model attribute
start_day_of_week to change this default. A value of 1 means Monday, 2 Tuesday and so on.
When subtracting or adding months, if the current day of the month is greater than the number of days in the resultant month, the effective date is the last day of that month. In both cases, time starts at 00:00:00. For example, if today was 30 June 2008, then %today_plus1month would be 28 June 2008, 00:00:00.
When subtracting or adding years, if the current day of the month is greater than the number of days in that month in the resultant year, the effective date is the last day of the month. For example, if today was 29 May 2008, then %today_plus1years gives 28 May 2009, 00:00:00.
Example