# How to connect an hour with a date?

**URL:** <https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994>\
**Category:** Ask for Help\
**Created:** [June 14, 2021, 11:22pm UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994 "2021-06-14T23:22:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Ruiz\_Molero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_ruiz_molero/32/15371_2.png) [@Eric\_Ruiz\_Molero](https://community.glideapps.com/u/Eric_Ruiz_Molero)\
**Post date:** [June 14, 2021, 11:22pm UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/1 "2021-06-14T23:22:04Z")

</div>

Hello all,

I hope this is a really simple question but it might not be that simple.

I have a GYM app with different classes. Each one with a static initial and final hour that repeats weekly.

I have achieve a minimal formula to know when to add 7 days or not. So I have the real-final-date in a column.

So, what I need is to connect that real-final-hour with the **static class hour**. But I haven’t achieve it yet. I have used the “Now” date to do the minimal formula so the real-final-date hour is the Now hour. But I don’t need that hour to be shown on the calendar. I need the static initial and final hour of the class.

Is there any way to achieve this?

THANK YOU!

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 14, 2021, 11:25pm UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/2 "2021-06-14T23:25:24Z")

</div>

Let me rephrase it to see if I get your idea, let’s say you have 7 rows that each have their own weekday (e.g: Monday, Tuesday) and then their pure starting and ending time (e.g: 7AM - 9AM).

So when one comes in and register, you want to have dynamic starting and ending time based on whatever date it falls to next week?

Let’s say Tuesday 7AM - 9AM this week would be converted to 15 June 2021 07:00 - 15 June 2021 09:00?

---

<div class="post-metadata">

**Author:** ![Eric\_Ruiz\_Molero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_ruiz_molero/32/15371_2.png) [@Eric\_Ruiz\_Molero](https://community.glideapps.com/u/Eric_Ruiz_Molero)\
**Post date:** [June 14, 2021, 11:28pm UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/3 "2021-06-14T23:28:24Z")

</div>

Yes, that’s the idea. But when Tuesdays class of 15 June 2021 9:00 has been passed and today is Wednesday 16 June, the app must show Tuesdays class of 22 June 2021 9:00.

What I mean is, how I can connect a static hour (in a separate column) with a dynamic date (that even if you put only show date has a default hour different from the static hour I need)?

---

<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:** [June 15, 2021, 1:32am UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/4 "2021-06-15T01:32:42Z")

</div>

I’d have to check how dynamic it is again, but date columns are actually pretty powerful. If you write the text value of ‘Tuesday at 9:00am’ or ‘Next Tuesday at 9:00am’, it will magically figure out the date. The part I’m not completely clear on is if it will dynamically update the date after each date has passed, or if it becomes static.

Some reference:

> [@Fun with Dates](https://community.glideapps.com/t/fun-with-dates/21684):
>
> I just remembered something from a long time ago. I don’t remember if I had posted about it in this forum or in the old spectrum forum. Can’t find the post in either forum right now. Working on these posts re-triggered this memory. What I had discovered back then is how ridiculously forgiving the calendar layout is. It can take dates in a variety of formats and still determine the correct date to show. But the really cool thing I had discovered is that you can feed it certain types of te…

> [@Fun with Dates](https://community.glideapps.com/t/fun-with-dates/21684/5):
>
> HOLY COW. [[image] ](https://media.tenor.com/images/3a29726ff95ca4e667c8ec0ae83689ff/tenor.gif) Playing with this for the rest of the day…wonder what would happen if you said “Next Month” on January 30…would it say Feb 28 or Mar. 2? or neither? EDIT: Minutes and hours work too. 3 minutes ago 10 min from now Month Abbreviations work (“Mar” = March 1) Week Abbreviations work (“Next Fri”) “This Morning” = 6am today “This Afternoon” = 3pm today “Tonight” = 10pm tonight “Next Tuesday at 9AM” “Feb 35” = 3/7/2021 Mar 7, 2021 …

@robert states it’s dynamic but maybe found a workaround:

> [@Fun with Dates](https://community.glideapps.com/t/fun-with-dates/21684/81):
>
> @Jeff_Hager perhaps a flaw here?

> [@Fun with Dates](https://community.glideapps.com/t/fun-with-dates/21684/83):
>
> I solved it—had to use a math column to convert the text to a date and then pass the math column instead: [Screen Shot 2021-02-10 at 10.48.35 AM]

Just some quick testing, when writing text in a date column and then changing it to a text column, it seems to hold it as a static date without time, but somehow retains the time. When writing text in a text column and then changing it to a date column, it seems to hold the text which converts dynamically to the correct date. Again, I’m not completely sure what the behavior will be, but that might be one way to have dynamically changing dates.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 15, 2021, 2:04am UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/5 "2021-06-15T02:04:52Z")

</div>

Hi Jeff, I dived a bit into this with some Math Columns. @Eric_Ruiz_Molero I hope this helps.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/b/1befa65e3efeb56cf72568275bc5688475833b84.png)

So I had a set up of date of week (in text), then start time and end time in numerical.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/a/4a73b5fb12a959d3919bda6f01dd3f2af7c78326.png)

The magic is mostly here:

```auto
 WEEKDAY(F)-WEEKDAY(N)+7-CEILING(LOG(WEEKDAY(F)/WEEKDAY(N)))*7

```

WEEKDAY(F)-WEEKDAY(N)+7 brings me to the corresponding weekday of **next week**.

Then WEEKDAY(F)/WEEKDAY(N) returns something less than 1 for days that have already passed (for example today’s Tuesday, then Sunday and Monday have passed) and more than 1 for days that have not already passed (Wednesday - Saturday).

LOG puts it in a -1 to 1 scale. Anything less than 1 here returns something less than 0, else it’s more than 0. I convert it to 0 and 1 with CEILING.

```auto
-CEILING(LOG(WEEKDAY(F)/WEEKDAY(N)))*7

```

returns -7 when the day has not already passed (so it’s for this week) and returns 0 when it needs to be next week.

The other 2 columns is just converting the time to the right offset.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/5/b5a34e4695c919ee04a3662e245d6f7d24df6a3c.png)

```auto
N+O-HOUR(N)/24-MINUTE(N)/1440-SECOND(N)/86400+S/24

```

Now + Offset minus everything related to hour, minutes and seconds for “now”, then add the corresponding starting hours.

Same setup for the ending time.

As this is another date-time related thing I hope you find this useful as well @Robert_Petitto @Darren_Murphy @Lucas_Pires.

Only thing I haven’t done is if it falls to the current day, then it should move to next week only when “now” is past the start time, but I think it’s a bit complex.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [June 15, 2021, 2:10am UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/6 "2021-06-15T02:10:50Z")

</div>

Amazing.

![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/9/f9e667aadd2b5b39cfa448234cdbf7e5f327d02f.gif)

---

<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:** [June 15, 2021, 2:36am UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/7 "2021-06-15T02:36:36Z")

</div>

![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/2/227840e2f9d4b59bead66ee469e3fc467541428a.gif)

---

<div class="post-metadata">

**Author:** ![Eric\_Ruiz\_Molero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_ruiz_molero/32/15371_2.png) [@Eric\_Ruiz\_Molero](https://community.glideapps.com/u/Eric_Ruiz_Molero)\
**Post date:** [June 15, 2021, 8:37am UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/8 "2021-06-15T08:37:13Z")

</div>

No words @ThinhDinh

Thank you so much!

---

<div class="post-metadata">

**Author:** ![NoCodeAndy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nocodeandy/32/62530_2.png) [@NoCodeAndy](https://community.glideapps.com/u/NoCodeAndy)\
**Post date:** [January 17, 2024, 4:51pm UTC](https://community.glideapps.com/t/how-to-connect-an-hour-with-a-date/27994/9 "2024-01-17T16:51:50Z")

</div>


