Displaying clock, either digital or analogue

Rather like my themometer1 question, I want to arrange to display the results of the smartphone clock on the smartphone. At present I am seeing a screenful of java (?) when I do this

Perhaps:

Thanks. These seem to be for the timer. I want to show the actual time at the user's location. The last one shows actual java code. I want to stay away from that!

Sounds like you are seeing the "instant" which contains all the variable elements of a specific time and date. You use the clock blocks to "normalise" and format your date/time.

Here is a link to some analog clocks you can make:
https://groups.google.com/g/mitappinventortest/c/0knJibIeZIU/m/RZeLZ8xUEAAJ

and a digital clock
https://groups.google.com/g/mitappinventortest/c/1nltbheE5g4/m/112zmbVwBQAJ

https://groups.google.com/g/mitappinventortest/c/G5Y-pukKkkw/m/2j_ItjgPCAAJ

Use this-
image

Many thanks to all!

What am I doing wrong? Clock blocks work fine giving the time when the button was pushed but when I try to make the clock stay on and update and I put them into a while loop, like this, nothing works. Before using the while loop all was fine

Don't use the while block, use the clock timer block, set to 1000msecs interval. Check the examples provided in your previous topic, they all use the clock timer block.

Confused by this. Could you just show me how to modify my block layout? Also, logically why doesn't the while loop work?

I posted an image example in my post.

Your while loop is probably running at 1000^ s per second, in an infinite loop, eventually to cause your app to crash, it is also not changing the time each second, regardless.

In @10 years of using App Inventor, I believe I have only ever once found a use for the while block, even then I reverted to using a clock timer. :wink:

You should also note that the App Inventor clock's timing can be deprecated by other events and procedures you may run while the clock is running. It is therefore recommended to routinely "reset" the time against the system time, or use an extension. This is if you need accurate timekeeping.

See the blocks below "The key element of the demo" in this example:

merged with other topic...