Simple SOQL to fetch records based on today’s day and month in Salesforce

Simple SOQL to fetch records based on today’s day and month in Salesforce

Sample Code:

        Date tody = system.today();
        String SOQL = ‘SELECT Id, Name, Email__c FROM Employee__c WHERE DAY_IN_MONTH(Date_of_Birth__c) = ‘ + 
                      tody.day() +  ‘ AND CALENDAR_MONTH(Date_of_Birth__c) = ‘ + tody.month();

Cheers!!!

Leave a Reply