-1

I have a schedule apex job that runs everyday in the morning at 2 AM, where I am trying to gather opportunities where custom date Reoffer_Date__c as today.

List opportunitiesList = [
        SELECT Id, Name, Employee_Contact__c, RecordTypeId, Employee_Contact__r.Gross_Income__c
        FROM Opportunity
        WHERE Reoffer_Date__c = System.TODAY()
];
2

As already proposed in the comments section, please tak a look at date literals like TODAY:
Date Formats and Date Literals

In terms of day(), it returns the day-of-month component of a Date (documentation). So if you want to have a full date, it's not the way to go.

As for the today, it returns current date (honoring user's time zone) indeed. It would be best for you to just review existing methods for System Class.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.