Is it possible to compare DateTime and Date in SOQL

I found the solution, after a lot of research Here's a link!

code:

hot = [SELECT id,Name,NRProduct__c, QuantityOrdered__c,Purchase_Date__c   
          FROM MWSOrderItem__c   
          WHERE DAY_ONLY(Purchase_Date__c )=:Date.today() AND 
                Buyer_lookup__c =:UserInfo.getUserId() ];    

Yes, that will work as expected.

You will get all MWSOrderItem__c with Purchase_Date__c between 12:00am and 11:59pm from variable d in our case Today.

Tags:

Class

Soql

Apex