Given a Date value, return the full name of the day of the week as a string (for example, 'Monday', 'Tuesday', 'Wednesday', etc.). Return null for null input.
Examples:
Input: d = Date.newInstance(2026, 5, 27)
Output: 'Wednesday'
Explanation: May 27, 2026 falls on a Wednesday
Input: d = Date.newInstance(2026, 1, 1)
Output: 'Thursday'
Explanation: January 1, 2026 falls on a Thursday
Input: d = Date.newInstance(2026, 6, 1)
Output: 'Monday'
Explanation: June 1, 2026 falls on a Monday
Input: d = Date.newInstance(2026, 12, 25)
Output: 'Friday'
Explanation: December 25, 2026 falls on a Friday
Input: d = null
Output: null
Explanation: Null input returns null
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay July 2026
Contest runs July 1 - 31. Complete challenges to climb the leaderboard!
Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.