Salesforce uses a custom employee management app to track the payroll details of all employees. The company's policy is to process payroll three days before the last day of the month.
The payment system is an external system that reads the data from salesforce to process the payment for an employee. You're given a task to write an apex method that returns the payment date for an input date.
Complete the given apex method to return the payment date for a given date.
Instructions :
1. Accept an input date parameter as input.
2. Calculate the payment date as three days before the end of the month of the given input date.
3. Return the date from step 2.
Example:
//Assume given date is 01-01-2024 (mm-dd-yyyy).
Integer daysLeft = payrollController.paymetDate(Date inputDate);
//Result
//The payment date is 01-28-2024 (mm-dd-yyyy)
Hint:
Use apex date methods to determine the payment date.
Click here to view all apex date practice examples