function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vinod TomarVinod Tomar 

NullPointer error in MonthBetween Method

Hi All,

I am getting below error

 

System.NullPointerException: Attempt to de-reference a null object



 

in code

 

Integer monthChangecount  = firstDate.monthsBetween(newStartDate);

 

where firstdate is 2011-02-01 and newstartdate is 2011-01-01

AmitSahuAmitSahu

Error sloud be for some other line. Could you share a bit more code with us?