You need to sign in to do that
Don't have an account?
Chidanand Magadum 24
NULL POINTER Exception while finding number of days between two dates
Hi,
I am getting null Pointer exception in this code while finding difference between two dates. Any workaround
Date d = Date.Today();
system.debug(d);
List<Account> AllAccounts= new List<Account>([select id,ARR__c,Relationship_Start_Date__c from Account]);
for(Account a:AllAccounts)
{
system.debug('Date==='+d);
system.debug('Trans Date'+a.Relationship_Start_Date__c);
Integer numberDaysDue= d.daysBetween(a.Relationship_Start_Date__c);
system.debug('Diff==='+numberDaysDue);
}
I am getting null Pointer exception in this code while finding difference between two dates. Any workaround
Date d = Date.Today();
system.debug(d);
List<Account> AllAccounts= new List<Account>([select id,ARR__c,Relationship_Start_Date__c from Account]);
for(Account a:AllAccounts)
{
system.debug('Date==='+d);
system.debug('Trans Date'+a.Relationship_Start_Date__c);
Integer numberDaysDue= d.daysBetween(a.Relationship_Start_Date__c);
system.debug('Diff==='+numberDaysDue);
}
Try this :
If this answers your question then hit Like and mark it as solution!