9

The current documentation for SOQL Date Literals does not have N_X_AGO on its list. In fact I had never seen the AGO date literals on any version of the documentation. So I am wondering if there are more "hidden" date literals and which rock they are hiding under.

2 Answers 2

9

These are not the date literals you're looking for....... :-)

The trick is that the filters that are available for filter criteria in list views and reports are secretly available in SOQL as well. You'll find them by checking out this link below. Most of these are already on your list, but the missing ones are here as well, just replace spaces with underscores!

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm

0
2

The link provided in the accepted answer does not include the hidden date literals, so I am not sure if SFDC modified their documentation page since then.

AFAIK, these are not specifically documented, but below is a list that I think is complete.

Here are the places that I sourced the list:

https://github.com/paustint/soql-parser-js

https://github.com/mulesoft/salesforce-soql-parser/blob/master/src/main/antlr3/org/mule/tools/soql/parser/SOQL.g

YESTERDAY
TODAY
TOMORROW
LAST_WEEK
THIS_WEEK
NEXT_WEEK
LAST_MONTH
THIS_MONTH
NEXT_MONTH
LAST_90_DAYS
NEXT_90_DAYS
THIS_QUARTER
LAST_QUARTER
NEXT_QUARTER
THIS_YEAR
LAST_YEAR
NEXT_YEAR
THIS_FISCAL_QUARTER
LAST_FISCAL_QUARTER
NEXT_FISCAL_QUARTER
THIS_FISCAL_YEAR
LAST_FISCAL_YEAR
NEXT_FISCAL_YEAR

NEXT_N_DAYS
LAST_N_DAYS
N_DAYS_AGO
NEXT_N_WEEKS
LAST_N_WEEKS
N_WEEKS_AGO
NEXT_N_MONTHS
LAST_N_MONTHS
N_MONTHS_AGO
NEXT_N_QUARTERS
LAST_N_QUARTERS
N_QUARTERS_AGO
NEXT_N_YEARS
LAST_N_YEARS
N_YEARS_AGO
NEXT_N_FISCAL_QUARTERS
LAST_N_FISCAL_QUARTERS
N_FISCAL_QUARTERS_AGO
NEXT_N_FISCAL_YEARS
LAST_N_FISCAL_YEARS
N_FISCAL_YEARS_AGO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.