Query records created Today or Yesterday in SOQL

Suyash N
Suyash N 8.2k Views Add a Comment

You can easily Query records created Today or Yesterday or which are Last Modified Today or Yesterday. No need to jump on dates and making dynamic queries to create the current date or yesterday’s date. You can even query records whose closedate is Tomorrow. Salesforce provides an easy way to query it. For this, you just need to append TODAY or YESTERDAY or TOMORROW in your WHERE clause of the query.

Salesforce provides so many Date Literals to directly use in your query. Check Here.

Check out these examples for easy understanding.

Accounts created Today:


Account Last Modified Today:


Opportunities whose CloseDate is Tomorrow:


Records created Yesterday:


Records Last Modified Yesterday:


Accounts created Yesterday AND Modified Today:


Accounts either created Yesterday or Today:


Also Check:

For any queries or suggestions, comment below.

Cheers … Happy Coding … 🙂

Share This Article
Leave a comment
Notify of
Inline Feedbacks
View all comments