How do you display current time through a label?

My question is how do you display the time through a label.

So I would like it to show

Current Time: 9:48 am

thanks!

1 Like

A simple example that shows date and time:

image

image

Gallery link:
https://gallery.appinventor.mit.edu/?galleryid=02d4b962-34b4-4c5e-8fdf-f17cc87dde23

2 Likes

If you want the clock to say 1:14 PM instead of 13:14 This is what you got to do:


it would look like this:
Time: [03:43 PM]

2 Likes

??? you did not handle the leading zero......

Are you talking about the 0 in 03:43 PM?

If so, I don't know how to do it, this is my first time trying to solve a problem.

But hopefully someone found this helpful!

1 Like

Format Date/time to

h:mm:ss a

Ohhhh so, instead of text
I change it to: text (1)
So now the time should be displayed as 3:45 PM instead of 03:45 PM right?
If so, THANKS A LOT!

I was trying to solve it by myself in many ways but didn't found an answer!

The answers are all here:

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

(Linked in the clock component help tooltip)

2 Likes