🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Help with RTC block in UIFlow / Blocks

    Scheduled Pinned Locked Moved UIFlow
    4 Posts 3 Posters 6.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • iamjameshannamI Offline
      iamjameshannam
      last edited by

      Im looking to show the time using the RTC blocks, when I show minutes (under 10 min) the minutes show as one digit, i.e. '2', rather than '02'. Is there a way (using blocks) to show time (hours and minutes) as two sets of double digits? ie. '01:01' not '1:1'

      1 Reply Last reply Reply Quote 0
      • W Offline
        wsanders
        last edited by wsanders

        You have to do it one character at a time, using “first letter” and “last letter”. For example (in the if/do/else block):0_1653428551357_838F761A-6860-49E0-99BC-4B4F3A38EC39.png

        In C or Python code of course you’d just use sprintf() or the equivalent.

        iamjameshannamI 1 Reply Last reply Reply Quote 0
        • iamjameshannamI Offline
          iamjameshannam @wsanders
          last edited by

          @wsanders Thats awesome, thank you!

          I was thinking that I could use an If statement...so if the minute value was less than 10 (say), you add '0' to the front of the number, same with the hour etc.

          1 Reply Last reply Reply Quote 0
          • ajb2k3A Offline
            ajb2k3
            last edited by

            Huh ?
            This shows it in the format you want 0_1653495527966_Screenshot 2022-05-25 at 17.18.00.png
            0_1653495684730_IMG_4259.JPG

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post