Salesforce Query – Filter by Date

I was trying to get records from Salesforce modified within the last day. But kept running into exceptions where SF would complain that data must be of type datetime and must not be enclosed within quotes which was weird. But here’s how I was able to set the datetime without quotes and execute the query:

SELECT Accellion_Net_Subscription_Revenue__c,AccountId,Amount,CampaignId,CloseDate,Company_Size__c,CreatedDate,Deployment_ID__c,Id,LastModifiedDate 
FROM Opportunity 
WHERE LastModifiedDate >=2016-03-09T00:00:00Z 
ORDER BY LastModifiedDate ASC 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s