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
RozRoz 

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:

 

Roz

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