Level 5

What Time Is It?

Level 5 · Chapter 10

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Combine loops and conditions, even nested ones.

Code 2-AP-12Read the official text

Also practised: 2-AP-17

Common Core State Standards for Mathematics

Expressions & Equations · Grade 6

Solve an equation with one unknown.

Code 6.EE.B.8Read the official text

The short lines are our own words. We matched this lesson to these standards ourselves; the standards' owners have not reviewed or endorsed this course.

Common Core State Standards © 2010 National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

Today you will use the current hour block to read the system clock and build time-aware programs.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-12 · CSTA 2-AP-17 · ISTE 1.5.c · Standards
🎯 I canuse the current hour block to read the system clock and build time-aware programs
🧩 New blocks1 block
📝 New words6 words
⏱ Lesson time~40 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students often expect (current [hour ▾]) to return 12-hour format. It returns 0–23. Midnight = 0, noon = 12, 11 PM = 23.
  • Students may confuse (timer) with (current). Timer counts seconds since the flag was clicked. current [second ▾] returns the clock's current second (0–59).

🎯 Differentiation

🐢 Struggling: Focus only on the greeting card (steps 2–3). Skip the digital clock until the basic if-else logic works.

🚀 Advanced: Challenge them to build an alarm: compare current hour AND current minute to a target time. Use AND to combine both conditions.

💡 During the lesson

  • Warm-UpAsk: "If (current [hour ▾]) returns 14, what time is it?" (2 PM.) "What about 0?" (Midnight.) Students from regions using 12-hour clocks may need a brief 24-hour format explanation.
  • Try ItWalk through the nested if-else logic: morning = hour < 12, afternoon = 12 ≤ hour < 18, evening = hour ≥ 18. Ask: "What would happen if you just used two separate if blocks instead of if-else? Could both fire?" (Yes — that's a bug. Only if-else guarantees one path.)
    The second experiment introduces the chapter's core mechanic: an if block that tests the hour before deciding what to say. Picking 9 and then 14 shows the difference between time-aware and always-on behavior. This feeds directly into the nested if-else greeting card in Plan & Build. Pick 20 too: Pico still says Good afternoon at 8 PM, which is why the build adds a second test, hour < 18. In the third experiment the timer matches the wait, but the clock second can be any number from 0 to 59.
  • PlanFive scripts run in parallel from one flag click — each handles one feature independently. This is the parallel-script pattern students have seen before, now applied to real-time sensing.
    The second box is the order of the tests. If «less than 18» comes first, the 14:00 run says Good Morning — the wider test catches every hour before 18, so the afternoon test never gets a turn. Pick, then watch both stages at each hour.
  • BuildSome students may want to format single-digit minutes with a leading zero (e.g., 9:05 instead of 9:5). This is a good extension challenge — use an if block to check if minute < 10, then join "0" before the digit.