+ Start a Discussion

SOQL queries with date parameters - please help

Hi there


VERY new to SOQL, though I have some knowledge of SQL.


Am getting an unexpected token error with the following query:


SELECT Id, Name, class_begin_date__c, class_end_date__c, class_location__c FROM Class__c
WHERE class_begin_date__c = 01/01/2008
AND class_end_date__c = 01/01/2009


Any help will be greatly appreciated.


I will eventually be including something similar in a Visualforce page which will allow people to refine search results based on To and From dates they enter.


Thanks. :robothappy:



Best Answer chosen by Admin (Salesforce Developers) 
You need to use the correct format for the date Literals (e.g. 2009-01-01) see the SOQL section of the api docs.