Salesforce uses a custom employee management app to keep track of employment details. The company has a six-month probation period for new employees.
The system requires counting the number of days remaining to complete the probation period for a new employee. Your task is to write an Apex method that accepts an employee's start date and returns the number of days left to complete the probation.
Complete the given Apex method to calculate the number of days remaining to complete the probation period for a given start date.
Instructions :
1. Accept a start date as a parameter input.
2. Calculate the number of days remaining to complete six months from the start date.
3. Return the number of days calculated in step 2.
Example:
//Assume startDate is 01-01-2024 (mm-dd-yyyy) and today is 01-01-2024
Integer daysLeft = employmentController.daysLeftForProbation(startDate);
//Result
//The number of daysLeft is 184
Hint:
Use apex date methods to find the number of days between two dates. To find all apex date methods, visit this article
Click here to view all apex date practice examples