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.

View solution in original post

ericonline
Community Champion
Community Champion

Aaaanddd... I think its time for bed 🙂 

Thank you @WarrenBelz

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,501)