I need to calculate days between two fields.
So I use daysBetween
to complete when I try to do with two dates. When I try with single values.
But, when I try with list it throws an error like:
Method does not exist or incorrect signature: [Date].daysBetween(List)
For reference my code:
public date closedates;
Public Long details;
List<Case> c = new List<case>();
List<Integer> Values = new List<Integer>();
List<Date> Churndate = new List<Date>();
List<Date> closedatesd = new List<Date>();
c = [Select Id, Date_Order_Received__c, accountId from case where RecordTypeId = '01290000000sF3L'];
System.debug('Data in Case ' + c);
List<Id> accountIds = new List<Id>();
List<Account> accounts = new List<Account>();
List<Id> opps = new List<Id>();
List<Date> Oppsdate = new List<Date>();
for (Case cl : c) {
accountIds.add(cl.accountId);
//Churndate=cl.Date_Order_Received__c;
Churndate.add(cl.Date_Order_Received__c);
}
System.debug('Date value in ' + churndate);
for (Account ao : [Select Id, name, (select Id, name, CloseDate from opportunities) from account where Id in : accountIds]) {
for (Opportunity opp : ao.opportunities) {
opps.add(opp.Id);
//details=closedates.daysBetween(Churndate);
**Values.add(opp.CloseDate.daysBetween(Churndate));**
//Other Operation you want to perform with every opportunity
}
}
Error line:
Values.add(opp.CloseDate.daysBetween(Churndate));