web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add leading zero to 24...
Power Apps
Answered

Add leading zero to 24hr clock?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I must be approaching this incorrectly! My code is getting unwieldly. 

Goal: 

- If 24 hour time is between the hours of 00:00 to 09:59, show the leading zero highlighted in bold.

Scenario:

- varNow set to Now()

  - This displays in Date + 12hr clock (I need Date + 24hr clock)

- Textbox Default property set to Text(varNow, ShortDateTime24)

  - This displays correctly:

ericonline_0-1611725008001.png

- However, when you cross midnight, there is no leading zero on the Hour

ericonline_1-1611725046879.png

And it (obviously) stays this way until there are two hour digits. 

 

HOW DO I GET THE LEADING 0?

 

I tried to Split varNow and parse out the Len of the hour field and Concatenate a "0", but then I lose the Date portion of the timestamp. 

 

Idears?

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @ericonline ,

    Try this

     Text(varNow, "[$-en]mm/yyyy/dd hh:mm")

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Aaaanddd... I think its time for bed 🙂 

    Thank you @WarrenBelz

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard