+ Start a Discussion
Keith Stephens 18Keith Stephens 18 

Soql for getting today's date - 2 days or 48 hours

Hello all,

I need to get/run this soql script from my .NET app, using CDATA ADO.NET components.
But my issue is my soql statment will not run in .NET or in the SOQL Workbench.


SELECT AccountBroker__c,Application_Date__c,Application_Manager__c,CaseNumber,Id FROM Case where LastModifiedDate >= Date.Today().addDays(-2)

Thanks,
KS
Best Answer chosen by Keith Stephens 18
Raj VakatiRaj Vakati
User this query 
SELECT Id ,CaseNumber,AccountBroker__c,Application_Date__c,Application_Manager__c FROM Case where LastModifiedDate >= LAST_N_DAYS:2

 
 

All Answers

Raj VakatiRaj Vakati
User this query 
SELECT Id ,CaseNumber,AccountBroker__c,Application_Date__c,Application_Manager__c FROM Case where LastModifiedDate >= LAST_N_DAYS:2

 
 
This was selected as the best answer
Nayana KNayana K
I am not sure about .NET app. But standard SOQL supports this:
SELECT AccountBroker__c,Application_Date__c,Application_Manager__c,CaseNumber,Id FROM Case where LastModifiedDate > LAST_N_DAYS:2

Reference:
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm


User-added image