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
Varsha JethwaniVarsha Jethwani 

apex code for : end date should set as next date of last payment date

suppose last_payment_date is 31.1.2023
then end_date must be 1.2.2023
So can I write this as

end_date = last_payment_date +1

Thanks in advance
AnkaiahAnkaiah (Salesforce Developers) 
Hi Varsha,

Please try with below code.
 
Date myDate = last_payment_date ;
Date newDate = mydate.addDays(1);

Please refer the below link for your reference.

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_date.htm#apex_System_Date_addDays

If this helps, Please mark it as best answer.

Regards,
Ankaiah Bandi