# 24 Hour datetime with leading 0's on Min and Sec. Is there a better way than how i am doing?

**URL:** <https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361>\
**Category:** Getting Started & Setup\
**Tags:** unreal-engine, question\
**Created:** [March 4, 2023, 2:05am UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361 "2023-03-04T02:05:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShawnDaGeek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shawndageek/32/734104_2.png) [@ShawnDaGeek](https://forums.unrealengine.com/u/ShawnDaGeek)\
**Post date:** [March 4, 2023, 2:05am UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/1 "2023-03-04T02:05:56Z")

</div>

Just wanting to know if there is a better way to get a datetime in this way.

MM-DD-YYYY hh:mm:ss with leading zeros on the minute and second and 24 hour format?

 ![2023-03-03 20_00_31-ShawnDaGeek_Studios - Unreal Editor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/6/226ff9e45de04b3834d4d992d87f39d83f408f4d.png)

---

<div class="post-metadata">

**Author:** ![eagletree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eagletree](https://forums.unrealengine.com/u/eagletree)\
**Post date:** [March 4, 2023, 3:01am UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/2 "2023-03-04T03:01:41Z")

</div>

I think you want the format text node. Here is a thread that shows that:

> [@Format Text (formatting numbers and dates)](https://forums.unrealengine.com/t/format-text-formatting-numbers-and-dates/151374/4):
>
> You can make a date time object and output that to text or string

---

<div class="post-metadata">

**Author:** ![ShawnDaGeek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shawndageek/32/734104_2.png) [@ShawnDaGeek](https://forums.unrealengine.com/u/ShawnDaGeek)\
**Post date:** [March 6, 2023, 4:11pm UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/3 "2023-03-06T16:11:50Z")

</div>

I tried this but it still left out the leading zeros. ☕😑

The issues i am finding is the time is returning this way from the engine when using the NOW node. I am formatting that.

---

<div class="post-metadata">

**Author:** ![eagletree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eagletree](https://forums.unrealengine.com/u/eagletree)\
**Post date:** [March 8, 2023, 4:00pm UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/4 "2023-03-08T16:00:29Z")

</div>

Sorry, I made an false assumption about the Format Text node. It doesn’t have a comprehensive formatting capability for ints and floats as I assumed it would. Hopefully someone else knows the answer on this.

I set up something similar to what you have only using the Len Node. Since this creates an overly complex set of statements, there may be something you could by putting the leading zero add on into a function. All that would do is clean up the code but not improve it in a meaningful way. The function would take in a 1 or 2 digit int and return a 2 digit string. That doesn’t really buy you anything, you’d still need 5 calls to it for each value (mm, dd, hh, mm, ss).

Edit: I dummied the other concept up just to see if it could be fewer nodes than your method. Here it is, and no, it’s not better, just different.

![Screen Shot 2023-03-08 at 09.44.54](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/6/bf6791cab9653118a226edd6028c24892914e543.png)

 ![Screen Shot 2023-03-08 at 09.25.35](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/5/a85f7a4dc2421817c1fd4de4ecdc1e5dc9beb14a.png)

---

<div class="post-metadata">

**Author:** ![ShawnDaGeek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shawndageek/32/734104_2.png) [@ShawnDaGeek](https://forums.unrealengine.com/u/ShawnDaGeek)\
**Post date:** [March 10, 2023, 8:57am UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/5 "2023-03-10T08:57:16Z")

</div>

I like the use of length, very nice.

I only wrote my method above to make it easy to understand my goal. it does not even take timing or latency on nodes into account and will possibly fail eventually lol.

I was just hoping their was a cheat sheet of codes like  
_`MM-DD-YYYY hh:mm:ss`_

---

<div class="post-metadata">

**Author:** ![freshkosose7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@freshkosose7](https://forums.unrealengine.com/u/freshkosose7)\
**Post date:** [October 8, 2023, 12:33am UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/6 "2023-10-08T00:33:47Z")

</div>

![Screenshot_4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/d/5/ad506a2edd4142c7216211b5fa07abf527c4530f.png)  
Or, you could make it super simple and just use this node. Convert a number of seconds into minutes:seconds.milliseconds format string (including leading zeroes).

---

<div class="post-metadata">

**Author:** ![Matt\_F.Judge](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Matt\_F.Judge](https://forums.unrealengine.com/u/Matt_F.Judge)\
**Post date:** [March 20, 2025, 7:57am UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/7 "2025-03-20T07:57:26Z")

</div>

Or use the **To Text (Integer)** node and enter the number of minimum integral digits. If your input has fewer digits it will add leading zeros. I put it in a macro.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/d/e7d28728a87fc1bc50f44631c06cf6f29039a28b.png)

---

<div class="post-metadata">

**Author:** ![cavia123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cavia123456](https://forums.unrealengine.com/u/cavia123456)\
**Post date:** [March 20, 2025, 2:10pm UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/8 "2025-03-20T14:10:40Z")

</div>

ok

---

<div class="post-metadata">

**Author:** ![DredPiratRob](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DredPiratRob](https://forums.unrealengine.com/u/DredPiratRob)\
**Post date:** [December 7, 2025, 7:36pm UTC](https://forums.unrealengine.com/t/24-hour-datetime-with-leading-0s-on-min-and-sec-is-there-a-better-way-than-how-i-am-doing/783361/9 "2025-12-07T19:36:00Z")

</div>

Ended up here hoping for a better way… but here is my current alternative.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/e/4/ee4500055c01dbac3d8f96fe50074ef3a34b99da.png)

Collapsed ToText nodes all min/max 2 digits
