Given a Date, return true if it falls on a Saturday or Sunday, and false otherwise. Return false for null input.

Example 1:

Input: inputDate = 2024-01-13 Output: true Explanation: January 13, 2024 is a Saturday, so the result is true.

Example 2:

Input: inputDate = 2024-01-07 Output: true Explanation: January 7, 2024 is a Sunday, so the result is true.

Example 3:

Input: inputDate = 2024-01-08 Output: false Explanation: January 8, 2024 is a Monday, so the result is false.

Example 4:

Input: inputDate = null Output: false Explanation: A null date cannot be evaluated, so the result is false.
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 August 2026

Contest runs August 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.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In