[SalesForce] How to query the data that has been modified in last 24 hours

How to define the "where clause" in SFDC SOQL to extract the date that have been modified in last 24 hours. Thanks.

PS : I am using the QUERY rest URI for query the data.

Best Answer

You can use the existing LastModifiedDate or SystemModStamp fields in your SOQL query (See System Fields). The LAST_N_DAYS or TODAY date literals may be useful. Otherwise you can use a specific calculated UTC Date time value.

Select Id from Account where SystemModStamp >= LAST_N_DAYS:1
Select Id from Account where SystemModStamp >= 2014-11-19T23:01:01Z

There was a recent blog post on the performance implications of LastModifiedDate vs SystemModStamp - Force.com SOQL Performance Tips: LastModifiedDate vs SystemModStamp