Free Salesforce Developers Tutorials >

Chapter 6 - SOQL >

Date Literals in SOQL

Date Literals in SOQL

What You’ll Learn


S2 Labs

What Is Data Literals In SOQL?

A date literal in SOQL is a fixed expression representing a relative time range, 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];

salesforce-developer

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 *