# Inconsistent results with relative dates

**URL:** <https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042>\
**Category:** Ask for Help\
**Created:** [January 8, 2025, 3:38am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042 "2025-01-08T03:38:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [January 8, 2025, 3:38am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/1 "2025-01-08T03:38:14Z")

</div>

I’m trying to create a query based on a date, but I’m getting inconsistent or weird results from various date functions. Both the “relative date” function and the math column (two examples of that latter below) return dates or times in which there is a 24 hour discrepancy for dates that aren’t the current day and I can’t figure out why.

 ![Screenshot 2025-01-07 at 7.26.19 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/0/80fac3e897a85e198b1e5e4821fca7c1f8848cb5.png)  
 ![Screenshot 2025-01-07 at 7.31.35 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/e/6ebf37859d66ade2042281f773cdeb134cb008a1.png)  
 ![Screenshot 2025-01-07 at 7.35.44 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/8/68ba5e392aa7b024592caaa52e1997a4b68b998e.png)  
 ![Screenshot 2025-01-07 at 7.36.01 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/a/3a1ed8620209a95f86eb1f3292c4380066a21e6d.png)

Is it an issue with the underlying data?

---

<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:** [January 8, 2025, 4:47am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/2 "2025-01-08T04:47:46Z")

</div>

Not sure I’m following completely, but your date math does include time, and based on your location, the difference between bow and yesterday at 12am is approximately 2 days, whereas the different between now and today at noon is less than 12 hours ago. Not sure what you are going for, but the results look correct to me. Also note that Relative time is approximate.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [January 8, 2025, 6:16am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/3 "2025-01-08T06:16:42Z")

</div>

Disregard my poor maths skills. But what I want is on Tuesday for Monday to be 1 day ago, but it displays as 2 days ago. I can’t control the data for the date as it comes from another source but is there a way to format it so that Monday is “1 day ago” if it’s Tuesday until it is actually 2 days ago I.e Wednesday at 12 am.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 8, 2025, 6:49am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/4 "2025-01-08T06:49:14Z")

</div>

I would convert both the date in question and “today” to integers using the following formula:

```auto
Year(Date)*10^4
+ Month(Date)*10^2
+ Day(Date)

```

and then you can do a straight numerical comparison.

---

<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:** [January 8, 2025, 7:18am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/5 "2025-01-08T07:18:32Z")

</div>

That won’t work well if subtracting 20241231 from 20250101, which results in 8870 instead of 1 day. I would use this instead to convert dates into numbers, excluding time.

```auto
TRUNC(Date)

```

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 8, 2025, 7:19am UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/6 "2025-01-08T07:19:31Z")

</div>

oh yes, good point 👍

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [January 8, 2025, 3:43pm UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/7 "2025-01-08T15:43:44Z")

</div>

This is great! Thank you both. That works.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [January 15, 2025, 3:44pm UTC](https://community.glideapps.com/t/inconsistent-results-with-relative-dates/79042/8 "2025-01-15T15:44:28Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
