Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Challenge: Formatting Time0:51 with Pasan Premaratne
Take a time value that I've provided, in seconds, and convert that to hours, minutes and seconds.
In this exercise, we're going to tackle a task that comes up quite often.
In programming, time is often measured in seconds, but
people aren't accustomed to reading it that way.
Your task is to take a time value that I've provided here, in seconds, and
convert that to hours, minutes, and seconds.
Use these values to then create a string literal
describing what the formatted time reads as.
Now I've provided an example here.
So you can see the final string would look something like this,
9700 seconds is 2 hours, 41 minutes and 40 seconds.
So to get this playground, go to the teacher's notes, grab it, and
then get started.
Also included are links to videos in case you get stuck.
In the next video, I'll go over my solution.
You need to sign up for Treehouse in order to download course files.Sign up