function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kvasirekvasire 

SalesForce Data Function

I am new to Salesforce coding.

How can i replicate this scenario in Microsoft sql " select * form table where modifieddate >= getdate() - 1" Salesforce coding??

Thanks for your help in advance.

Best Answer chosen by Admin (Salesforce Developers) 
matermortsmatermorts

Are you trying to get records where the last modified date is greater or equal to yesterday? Make your where clause "Where LastModifiedDate >= YESTERDAY"

 

Also see: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm

All Answers

matermortsmatermorts

Are you trying to get records where the last modified date is greater or equal to yesterday? Make your where clause "Where LastModifiedDate >= YESTERDAY"

 

Also see: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm

This was selected as the best answer
AmitSahuAmitSahu

You can use System.now().addDays(-1)  for getting records from any date.