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
shubham r 9shubham r 9 

Fetch Records where created date = today Query in Batch

My Question: If i schedule a batch at 11:59pm
which has query- select records where createddate = today
and the org does not have resources to execute the batch so it gets executed next day say at 00:10am
then records fetched will be of which date?
scheduled date(which was yesterday) or execution date?
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Shubham,

The records will be taken based on the start query execution time. If the query got executed at 11:59 then it will take all the records for that day. If it executes at 00:10 AM then it wont take the records that were created the previous day. 

If this solution helps, Please mark it as best answer.

Thanks,