Fun with Dates

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 text and it will figure out the correct date. I just realized you can do the same thing with a date column.

For example, type the following in a date column and it will convert it to the correct date:

  • tomorrow
  • yesterday
  • 3 days ago
  • 3 days from now
  • 3 years
  • 3 years ago
  • next week
  • last week
  • next month
  • last month
  • monday (nearest date)
  • august (nearest date)
  • etc.
    image converts to image
    You get the idea. It’s awesome because if you type in that text, it will do the math for you and return the correct date. The only downside is that it only seems to do the math from today, so I’m not sure how to do the same thing with different dates other than today. I’ve known for a long time that this was possible with the calendar layout, but I didn’t put two-and-two together until now that it will also work with a date column. This might be useful for some kind of recurring events or some other logic.

I’d be curious if anybody else discovers some other text that works or some other use cases. It appears that it converts the text to a static date, so it will not continually roll as the date and time changes. Could be useful in a form where you just want to write a date two weeks from now without making a user select a date in a calendar or doing some backend date math to figure it out. Might save on a couple of computed columns.

Maybe the Glide team could shed some light on all the possible combinations of text that can be converted into a calculated date.

26 Likes

WOW…had no idea! This makes SO much sense now though! Thanks Jeff!

I wonder if EOD would work…or how to figure that out…hmm :thinking:

3 Likes

Wow this is absolutely incredible.

2 Likes

This is great. Did not know about it

Even if we are typing just “2 years”, it shows date after 2 years from now. This is amazing.

3 Likes

HOLY COW.

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 :rofl:
  • Works nicely in Set Value/Add Row Actions…though it didn’t capture the time…
10 Likes

Looks like you found a bug, that should be 7/3/2021 :stuck_out_tongue:

1 Like

Silly me and my American bias :slight_smile:

1 Like

hehe, actually I don’t like either. Whichever way you go, it’s going to confuse one group of people.
I always use yyyy-mm-dd
Apart from being easier to read, it has the added benefit of sorting naturally as a string.

4 Likes

Guys, what’s the best way to get weekdays names like Monday, Tuesdays, Wednesday, etc?

Most straightforward way is to derive the weekday from the date using a math column, and then an ITE: if weekday is 1 then Sunday etc.

I learned this the hard way a few weeks ago, I assumed 1 was a Monday but it was a Sunday haha.

6 Likes

I usually ask my 3 year old son, he knows them all by heart :joy:

4 Likes

True! Thanks @ThinhDinh

1 Like

This is exactly what I do.

2 Likes

Americans against the world, you do everything differently!:joy:
I’m moving to Atlanta next year, I’m gonna have such a hard time with dates and temperatures

3 Likes

@Pablo_Miguel_Martine

Welcome to the club. I’m still trying to understand temps.

2 Likes

Here’s all you need to know…

72= perfect
32= freezing

5 Likes

I really want to respond with something clever, but I won’t… :grin:

1 Like

@Robert_Petitto
Hahah!!!

1 Like

72 is perfect, but 32 isn’t freezing…that beautiful weather and quite comfortable to be outside and go for a walk. When it’s -20 (not factoring in wind chill), and the grease around the steering wheel becomes stiff, the foam in the seats become rock hard, and after a 20 minute warm-up and a 15 minute drive, the car vents are still only blowing luke warm air, then you know it’s freezing and you have to put on a jacket.

You see, us americans need our own temperature scale because we can live anywhere from a -40 degree frozen hell to a 110 degree burning hell and everything in between. We need bigger numbers so it’s easier to brag to others that we are tougher than everybody else.

However, telling people you are going 100kph is way cooler than saying you’re going 60mph, so we screwed up there.

3 Likes

I have no idea what you’re talking about :rofl:

1 Like