Free Salesforce Developers Tutorials >

Chapter 6 - SOQL >

Date Literals in SOQL

Date Literals in SOQL

What You’ll Learn


What are the Date Literals in SOQL?What are the Date Literals in SOQL?

Various Data Literals in SOQLVarious Data Literals in SOQL

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];

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners. But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *