cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericonline
Community Champion
Community Champion

Add leading zero to 24hr clock?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

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.

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

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.

ericonline
Community Champion
Community Champion

Aaaanddd... I think its time for bed 🙂 

Thank you @WarrenBelz

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (4,652)