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
VSK98VSK98 

System.QueryException: unexpected token: '2020-03-05'

Hello All,

Getting System.QueryException: unexpected token: '2020-03-05' while running the batch class.
 
Date d = date.today();
String soql = 'SELECT id,date__C, Status  FROM Lead WHERE date__C =:' +
                      d + ' OR 10days__C =:' + d;
Regards,
VSK98
ShirishaShirisha (Salesforce Developers) 
Hi,

Greetings!

There is difference between the date formats when it comes to the SOQL query.Can you please go through the below documentation for more details:

https://support.workato.com/support/solutions/articles/1000236426-salesforce-object-query-language-soql-basic-syntax-and-common-search-terms

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri