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()
];
Best Answer
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.