I want assign a date value into a WHERE clause of query This is my date
Date myDate = System.Today().AddDays(Integer.valueOf(Deal_Expiration_Batch_Settings__c.getInstance().Expire_Notification_Prior_Days__c));
And this is my WHERE clause
String strQuery = ' SELECT Id + ' FROM bDeal__c WHERE End_Date__c =:' + myDate)';
Here myDate is retrun the value as 2018-06-01 00:00:00 But End_Date__c in the query is returning as 2018-06-01
So I am getting an error System.QueryException: unexpected token: '2018-06-01'
How to resolve this. Please anyone help me.
I have tried to format the date using myDate.format() method. But it is returning the values as string. I want a Date type value.