function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StormConsultingStormConsulting 

SOQL SELECT Query

I have an object with a datetime field. I want to select all records from this object where the datetime's month and year value, equals the current month and year.

So it might look like

SELECT Name FROM myObj__c WHERE date_time.getMonth() = currentMonth AND date_time.getYear() = currentYear

Any help is much appreciated!
Drew1815Drew1815
I think you want to use some of the SOQL supported Date Literals as detailed here:
http://www.salesforce.com/us/developer/docs/api/index_CSH.htm#sforce_api_calls_soql_select_dateformats.htm

You can try THIS_MONTH and THIS_YEAR in your Where clause.