A date literal in SOQL is a fixed expression that represents a relative range of time, such as last month, this week, or next year.
Whenever we write date literals it substitutes a value that should be there and which is dynamic.
Various Date Literal in Salesforce
- Yesterday
List<Account> accList;
accList = [SELECT Id FROM Account WHERE createdDate = Yesterday];
- Today
accList = [SELECT Id FROM Account WHERE createdDate = Today];
- Tomorrow
accList = [SELECT Id FROM Account WHERE createdDate = Tomorrow];
- Last_Week
accList = [SELECT Id FROM Account WHERE createdDate = Last_Week];
- Last_Month
accList = [SELECT Id FROM Account WHERE createdDate = Last_Month];