-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
  • I'm not sure what the question is exactly, but you can easily solve this with using the Date Literals in SOQL: developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/… Just use SELECT Id FROM Opportunity WHERE Reoffer_Date__c = TODAY
    – Folkert
    Sep 25, 2020 at 7:45
  • Please form an actual question so the community can try to help you.
    – Semmel
    Sep 25, 2020 at 8:25

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .