Use Time Zone-Enabled Dates in SAQL Projections
Access Date Functions with Time Zone Enabled
Group By Date
Order By Date
Filter By Date
Handle Null Dates
Windowing Functions
coalesce
Previous Versions
You can filter results by DateTime and DateOnly fields. Filters can include exact dates, specific date ranges, or relative date ranges.
| Type of Filter | Example |
|---|---|
| exact date range | q = filter q by year('CloseDate')=='2018'; |
| specific date range | q = filter q by year('CloseDate') in [2017..2018]; |
| relative date range | See the examples below. |
Examples of relative date range filters:
1q = filter q by CloseDate in ["last 2 years"];
2q = filter CloseDate in ["current fiscal_year".."current day"];
3q = filter CloseDate in ["2 fiscal_years ago".."current day"];Filter with binary comparison operators ==, !=, <, >, <=, and >= only after your query’s foreach statement, post-projection. For example, include the filter q = filter q by CloseDate >= "2014-01-01" post-projection. If you include it pre-projection, the query throws an error. The inability to include filters that use these comparison operators pre-projection is a limitation of the beta release.
You can filter pre- and post-projection with the IN comparison operator. The like and matches operators are not supported for time zone-enabled DateTime and DateOnly fields.
Note
You can use these relative date keywords:
current dayn day(s) agon day(s) aheadcurrent weekn week(s) agon week(s) aheadcurrent monthn month(s) agon month(s) aheadcurrent quartern quarter(s) agon quarter(s) aheadcurrent fiscal_quartern fiscal_quarter(s) agon fiscal_quarter(s) aheadcurrent yearn year(s) agon year(s) aheadcurrent fiscal_yearn fiscal_year(s) agon fiscal_year(s) agoSee Also