How do I Write a SOQL query which selects all leads that are modified within 60 minutes from now
Select all the lead Lastmodified date within 60 minutes or last hour
1 answer
The easiest way might be to make the following Minutes_Since_Modified__c formula:(NOW() - LastModifiedDate) * 24 * 60Then to query for it:SELECT Id FROM Lead WHERE Minutes_Since_Modified__c <= 60OR Datetime hourBack = Datetime.now().addMinutes(-60);
List<Lead> records = [
SELECT Name FROM Lead
WHERE LastModifiedDate >= :hourBack
];