Snippet
SOQL
26 Apr 2026
SOQL: records modified since yesterday
Relative date literals beat hand-built timestamps every time — and they respect the user's time zone.
SELECT Id, Name, LastModifiedBy.Name, LastModifiedDate
FROM Account
WHERE LastModifiedDate = YESTERDAY
OR LastModifiedDate = TODAY
ORDER BY LastModifiedDate DESC
LIMIT 200Relative date literals beat hand-built timestamps every time — and they respect the user's time zone.
Gotchas
YESTERDAY is the user's calendar yesterday, not 'the last 24 hours' — for a rolling window use LastModifiedDate >= :DateTime.now().addHours(-24) from Apex instead.