Salesforce Fact #2 | Date check SOQL

If we want to extract the day from a date/time field, we can use the DAY_ONLY function. Suppose, if I want to get the accounts which were created on 1st Jan,2021 we can use the below query:

SELECT Name FROM Account WHERE Day_Only(CreatedDate) = 2021-01-01 i.e. (YYYY-MM-DD)

Note: we need not enclose the input date inside quotes.

Comments

Popular posts from this blog

Salesforce Fact #218 | Blank picklist value is actually NULL

Salesforce Fact #947 | Resolving dashboard logged-in user limit error

Salesforce Fact #989 | New delete files permission