답변 3개

Investigate the dayOfWeek method
Save the computations related to start date and modulos.RegardsAndrewInteger month = 10;
Integer year = 2019;
Integer numberDays = Date.daysInMonth(year, month);
Integer noOfSun = 0;
for(Integer i=1;i<=numberDays ;i++)
{
Date myDate = date.newInstance(year, month, i);
Datetime dt = (DateTime)myDate;
if(dt.format('EEEE' == 'Sunday')
{
noOfSun = noOfSun + 1;
}
}