User Story
Create a program that counts the number of the days of the current year
What to practice?
- daysbetween()
- daysInYear
- dayOfYear
Solution 1
Integer currentYear= Date.today().year();
Date firstDate = Date.newInstance(currentYear, 1, 1);
Date lastDate = Date.newInstance(currentYear, 12, 31);
Integer totaldays=firstDate.daysbetween(lastDate);
System.debug(totaldays);
Solution 2
Integer daysIn2023 = Date.newInstance(2023, 12, 31).dayOfYear();
System.debug(daysIn2023);
Video
Video does not exists.