🤖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

    UIFlow
    3
    4
    4.9k
    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
      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
        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
          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
            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
            • First post
              Last post