# Unusual Date Rounding?

**URL:** <https://community.glideapps.com/t/unusual-date-rounding/77255>\
**Category:** Ask for Help\
**Created:** [October 22, 2024, 3:12pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255 "2024-10-22T15:12:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Siegel](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/greg_siegel/32/40613_2.png) [@Greg\_Siegel](https://community.glideapps.com/u/Greg_Siegel)\
**Post date:** [October 22, 2024, 3:12pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/1 "2024-10-22T15:12:53Z")

</div>

I’ve been trying to do a fairly simple thing – selecting a series of times of day (e.g. 7:00 p.m.) from a dropdown.

In the processing of that data, I’m getting to substantial issues with a) dates being stored despite it being “time only” and b) processing to remove those dates resulting in bizarre rounding. So looking for help on how to avoid this in implementation.

Here’s a summary of what I’m seeing:

1. If you have a dropdown column of values like “7:30 PM”, when that option is selected via an input form, it seems to store 7:30 PM + a date value. I can find no way to not have it store a time value only, even though the column type is “time only”

2. If you do math like time - trunc(time) – to remove the date value, I _sometimes_ get a shift of exactly 5 minutes. Other days there’s no shift. I assume it’s some bizarre rounding in the data storage layer?

Thoughts?

---

<div class="post-metadata">

**Author:** ![micheal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/micheal/32/80181_2.png) [@micheal](https://community.glideapps.com/u/micheal)\
**Post date:** [October 22, 2024, 3:27pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/2 "2024-10-22T15:27:38Z")

</div>

> [@How to change the date format](https://community.glideapps.com/t/how-to-change-the-date-format/77022/4):
>
> The column type is Date & Time. The value always includes a time component, regardless of how it was entered or how you choose to display it. That said, you should be able to filter against a user-supplied date by using “is within”. If your filter isn’t working, please show us how you have set it up, and the data.

aside from that another thing to try out is using a format date column (using Luxon) with “T”  
or check other formats here [luxon - Immutable date wrapper](https://moment.github.io/luxon/?gspk=cm9iZXJ0cGV0aXR0bzU5NDE&gsxid=CuVsGZry2f8X0J#/formatting?id=table-of-tokens)

---

<div class="post-metadata">

**Author:** ![Greg\_Siegel](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/greg_siegel/32/40613_2.png) [@Greg\_Siegel](https://community.glideapps.com/u/Greg_Siegel)\
**Post date:** [October 22, 2024, 3:35pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/3 "2024-10-22T15:35:10Z")

</div>

Thanks - so any sense on why the time - trunc(time) is rounding unpredictably by 5 minutes or so (and how to remove that)?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 22, 2024, 3:47pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/4 "2024-10-22T15:47:12Z")

</div>

What are you trying to do with this time value?

First of all, there is no such thing as a time only column. If you are referring to a date column, then that is designed to hold both a date and a time with the option to adjust the visible formatting to be date, time, or both. Underneath it’s still a full date and time.

Are you trying to merge that time with a date? Are you trying to do any date math with it? How is it ultimately being used?

A couple initial thoughts would be to just store it in a text column. Or change the table that your choice component is sourced from to show the time but write the decimal equivalent of that time to the table, which makes date math a lot easier. There’s a few different approaches, but it depends on how you intend to use that time value everywhere else in your app.

---

<div class="post-metadata">

**Author:** ![Greg\_Siegel](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/greg_siegel/32/40613_2.png) [@Greg\_Siegel](https://community.glideapps.com/u/Greg_Siegel)\
**Post date:** [October 22, 2024, 3:56pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/5 "2024-10-22T15:56:07Z")

</div>

Two time columns are being used to calculate a time difference every day (work started - work ended) – and then graph it as well (start time by day / end time by day)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 22, 2024, 4:21pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/6 "2024-10-22T16:21:11Z")

</div>

I think what I would do is figure out the decimal equivalent of each time. For example, 7am = 0.29166 and 5pm = 0.70833. The different is 0.41667. Those decimal values would be what your choice component writes to the table, but you would still display the friendly version of those times.

Doing the math like this would give you a 10 hour difference between 7am and 5pm

```auto
now-now+.70833-.29166

```

 ![Screenshot_20241022-112229](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b36708dba9642f79a745e1413b4e0a012fa8f2ba.png)

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [October 22, 2024, 10:19pm UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/7 "2024-10-22T22:19:11Z")

</div>

> [@Greg\_Siegel](#):
>
> a) dates being stored despite it being “time only”

Jeff’s answer:

> [@Jeff\_Hager](#):
>
> First of all, there is no such thing as a time only column

And a guide on dates that might help bring some clarity:

> [@date Guide: Mastering Dates & Times](https://community.glideapps.com/t/guide-mastering-dates-times/70381):
>
> The Date & Time column contains both a date and time value within one single value. Dates and times can therefore be tricky to understand and to work with. It helps to keep things simple to stay out of trouble. Here are a few tips: Writing dates Avoid writing dates manually. Use a picker instead. If done via import, be weary of the format of the date column in the source. Relations Anytime you create a relation with a date, convert the date to either a string (template column) or a number (…

---

<div class="post-metadata">

**Author:** ![Greg\_Siegel](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/greg_siegel/32/40613_2.png) [@Greg\_Siegel](https://community.glideapps.com/u/Greg_Siegel)\
**Post date:** [October 23, 2024, 4:25am UTC](https://community.glideapps.com/t/unusual-date-rounding/77255/8 "2024-10-23T04:25:07Z")

</div>

Thanks all - that was helpful. Switching over to decimal values helped.
