Soql query for opportunities between two dates

I am trying to find opportunities created between 01-01-2011 and 06-30-2011.

Select o.CreatedDate, o.Id, o.LastModifiedDate
from Opportunity o 
where   o.CreatedDate > '1/1/2011' and o.CreatedDate <  '12/31/2011'
order by  o.LastModifiedDate

since createate is a date-time, I get an error that createdDate is datetime and should not be quoted.

Can someone help on how to make this request work. I just want this request to run it in apex explorer, this is not part of apex code

+5
source share
1 answer

SOQL query to get features between two dates:

Select o.CreatedDate, o.Id, o.LastModifiedDate 
from Opportunity o 
where   o.CreatedDate > 2011-01-01T00:00:00Z and o.CreatedDate < 2011-12-31T00:00:00Z 
+9
source

All Articles