SOQL:
[SELECT Id,Name FROM Account WHERE createddate=THIS_MONTH]
This query is working fine when it is called from button, but it is unable to filter according to the created date when it is invoked from a batch apex.
SOQL:
[SELECT Id,Name FROM Account WHERE createddate=THIS_MONTH]
This query is working fine when it is called from button, but it is unable to filter according to the created date when it is invoked from a batch apex.
Best Answer
Based on the test below, the THIS_MONTH date literal does work in batch Apex.
I took your code (that I presume is a contrived example) and added debug log output:
and ran it from the Developer Console:
and got the expected output (of 2 Accounts I just created):