# Best way of displaying the time from a date range with time

**URL:** <https://community.fibery.io/t/best-way-of-displaying-the-time-from-a-date-range-with-time/6027>\
**Category:** API & Programming\
**Created:** [March 28, 2024, 12:33pm UTC](https://community.fibery.io/t/best-way-of-displaying-the-time-from-a-date-range-with-time/6027 "2024-03-28T12:33:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomvb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/tomvb/32/8764_2.png) [@tomvb](https://community.fibery.io/u/tomvb)\
**Post date:** [March 28, 2024, 12:33pm UTC](https://community.fibery.io/t/best-way-of-displaying-the-time-from-a-date-range-with-time/6027/1 "2024-03-28T12:33:30Z")

</div>

I have a date range with time field that I want to use in a formula inside Fibery. I’m running into formatting issue’s. I succeeded in displaying the time like I want to, but it feels like a complicated workaround.

The date range with time field is named `Timeslot` and is set to March 28, 08:00 - 10:30

**Problem** : `ToText(Hour(Timeslot.Start())) + ":" + ToText(Minute(Timeslot.Start()))` displays as `8:0`

I want to display the time as `08:00`

**My workaround** :

```auto
If(Hour(Timeslot.Start()) < 10, "0", "") +
ToText(Hour(Timeslot.Start())) +
":" +
If(Minute(Timeslot.Start()) < 10, "0", "") +
ToText(Minute(Timeslot.Start()))

```

This displays as `08:00`

Is there a better way of doing this?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 28, 2024, 2:30pm UTC](https://community.fibery.io/t/best-way-of-displaying-the-time-from-a-date-range-with-time/6027/2 "2024-03-28T14:30:32Z")

</div>

If you want to have zero-padding for any number, a nice way of doing this is  
`Right("0“ + ToText(number), 2)`

(this will force any integer up to 9 to be shown as a 2 digit number, and any number from 10 to 99 to be shown as is)

The same logic can be used for zero-padding larger numbers, e.g.  
`Right("000“ + ToText(number), 4)`  
etc.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 28, 2024, 2:33pm UTC](https://community.fibery.io/t/best-way-of-displaying-the-time-from-a-date-range-with-time/6027/3 "2024-03-28T14:33:48Z")

</div>

FYI we have a feature in the backlog for allowing users to specify formatting (of dates/times) when using the ToText function. Fingers crossed this might get rolled out before too long.

---

<div class="post-metadata">

**Author:** ![tomvb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/tomvb/32/8764_2.png) [@tomvb](https://community.fibery.io/u/tomvb)\
**Post date:** [March 29, 2024, 9:24am UTC](https://community.fibery.io/t/best-way-of-displaying-the-time-from-a-date-range-with-time/6027/4 "2024-03-29T09:24:32Z")

</div>

That would be really nice! Thank you for the better workaround.
