Practical guides

Build a Work-Hours Calculator with Gemini Canvas: A Beginner Guide

Describe your inputs and calculation rules in plain language, then verify the results. Includes a reusable prompt, expected answers, and checks before sharing.

Build a Work-Hours Calculator with Gemini Canvas: A Beginner Guide
Build a Work-Hours Calculator with Gemini Canvas: A Beginner Guide

Start with a small tool

If you repeatedly calculate work hours, describe the inputs and rules to Gemini Canvas. This is a guided example based on official documentation. ST_STUDIO has not generated and run this specific example in Canvas to verify the finished app.

Get started

Sign in to Gemini on the web with your Google account, select Canvas near the prompt box, and paste the request below. Menu placement may vary by account and interface. You can ask for changes in the conversation and inspect the app preview.

A reusable prompt

Build a work-hours calculator. Inputs: start time, end time, and break duration in minutes. Calculate same-day times only. If the end time is earlier than the start, show an error instead of assuming the next day. Subtract breaks from elapsed time and display both hours/minutes and decimal hours. Breaks must be non-negative and cannot exceed elapsed time. Show an input reminder for empty fields rather than treating them as zero. Add a reset button and large mobile-friendly text. Do not add external APIs, login, data storage, or AI calls; only calculate in the browser.

Check the answers

These are expected answers derived from the rules, not records of a successful Canvas run. Enter them in your generated app and compare. If an answer is wrong, provide the inputs, expected answer, and actual result. For example: “09:15 to 12:00 minus a 15-minute break should be 150 minutes. Check minute-based arithmetic and decimal-hour conversion.”

  • 09:00–18:00, 60-minute break → 8 hours 0 minutes, 8.00 hours

  • 09:15–12:00, 15-minute break → 2 hours 30 minutes, 2.50 hours

  • 09:00–09:00, no break → 0 hours 0 minutes

  • 18:00–09:00 → an error explaining the same-day restriction

  • A break longer than elapsed time, a negative break, or an empty field → input error

Make one change at a time

Ask for one specific change, such as “Make the result larger,” “Default the break to zero minutes,” or “Explain invalid input below the field.” Run the checks again after each functional change to spot regressions.

Before you use or share it

This is a simple time-calculation exercise. Payroll, overtime, and legally defined working hours require separate rules. Start with fictional numbers, not employee names or real timesheets. Before creating a public link, review the app information and its data storage/sharing behavior. Google warns that people with a public link may view and edit data associated with the app.

Official Google introduction

Published on March 18, 2025. The interface may differ today. This video introduces Canvas; it does not demonstrate the calculator in this guide.

Playing connects to YouTube, which may collect viewing and device data and use cookies.

Official sources

Sources checked November 4, 2026. The cover is an AI-generated conceptual illustration, not a screenshot of a running app.

Read the original source ↗

Comments

Korean and English comments appear together in their original language.

Loading comments…

Leave a comment

No account or email needed. Comments appear after administrator approval. Use a password you do not use elsewhere; there is no password recovery. Do not include personal information, links, images, or HTML. Privacy details

Manage my comment