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
NervosaNervosa 

LIKE operator for Date type

Greetings to everyone!

 

I've got a little question - what should i use in SOQL query for date type instead of LIKE? Maybe there some casting should be used?

 

The deal is - there is a query in my Apex controller:

String qry = 'select id, name, createddate, item_price__c from Item__c ' +
        'where name LIKE \'%'+searchText+'%\' and Release_Date__c LIKE \'%'+searchDate+'%\' order by name';

 Release_Date__c - date type of course.

 

Can you help me?

kiranmutturukiranmutturu
The LIKE operator is supported for string fields only.....i think when you are using date fields, scenarios would come as using the current date or comparison between date ranges...etc....