I'm working on the #APEX Unit Testing unit on #TrailHead, and I saw what appears to be a very useful Date method, DateWithin30Days(date1, date2) This would be very useful for some of my projects, but I can't find it any where in the APEX documentation.
Here is the code sample:
public static Date CheckDates(Date date1, Date date2) {
//if date2 is within the next 30 days of date1, use date2. Otherwise use the end of the month
if(DateWithin30Days(date1,date2)) {
return date2;
} else {
return SetEndOfMonthDate(date1);
}
}
Best Answer
The method
DateWithin30Days(Date 1, Date 2)
that you have referred here is not a standardDate
method.It is though still an Apex method but declared right within the class where you see this code. You are most likely looking at this code from trailhead, which you can always utilize for your purpose.