How to query DateTime field in Salesforce?

Salesforce stores the DateTime in GMT.

Below SOQL will give the number of accounts that were created between 5 PM to 5.15 PM EST.

Since EST is +5 from GMT, 12 + 5 + 5 = 22 is used in the query.

Sample SOQL:

SELECT COUNT( Id ) FROM Account WHERE CreatedDate >= 2019-03-04T22:00:00Z AND CreatedDate <= 2019-03-04T22:15:00Z


No comments:

Post a Comment