We cannot directly query with datetime field in where condition.
So you will need to use Date functions in SOQL to query using datetime field in where condition
Example:
Opportunity =[SELECT Id, Name FROM Opportunity WHERE DAY_ONLY(CreatedDate)= '2011-10-16'];
Refer other date functions which are available so that you can query easily using datefield in where condition.
Date functions