+ Start a Discussion
Abhi sfdcAbhi sfdc 

How to count the number of opportunity for a particular date?

 I want to count the number of opportunities for a particular date.
should be something like this :
SELECT count() FROM Opportunity WHERE CreatedDate > 2015-06-30T00:00:00Z
Try this,

List<AggregateResult> agg=[SELECT COUNT(Name) c FROM Opportunity WHERE CreatedDate > 2015-01-01T00:00:00Z];
Integer tCount=(Integer)agg[0].get('c');
Abhi sfdcAbhi sfdc
Thanks Nikunj and Bhawna for your prompt response.