# Extracting the "day of the week" from the date

**URL:** <https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189>\
**Category:** Ask for Help\
**Created:** [August 8, 2021, 7:15pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189 "2021-08-08T19:15:35Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [August 8, 2021, 7:15pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/1 "2021-08-08T19:15:35Z")

</div>

Hi fellow gliders,

If I have a known date and you display it in the long format, you are given the day of the week as well. Is it possible to display on the day of the week and not any other information e.g. display only “Monday” or “Tuesday”.  
This I would want to use to relate to another table if possible…  
Thanks

---

<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:** [August 8, 2021, 7:21pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/2 "2021-08-08T19:21:21Z")

</div>

Use WEEKDAY(date) in a math column. You can use the resulting number for your relation, or use an IF column to convert the number to the day name.

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [August 8, 2021, 7:23pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/3 "2021-08-08T19:23:18Z")

</div>

Thank you @Jeff_Hager …  
You are a 🌟

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [August 8, 2021, 7:25pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/4 "2021-08-08T19:25:36Z")

</div>

I get numbers e.g. 2/5/10…

Any idea how I convert this to actual days e.g. Monday/Tuesday

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [August 8, 2021, 7:27pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/5 "2021-08-08T19:27:56Z")

</div>

Use it in a template

---

<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:** [August 8, 2021, 7:29pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/6 "2021-08-08T19:29:26Z")

</div>

How do you get 10 as a result? There are only 7 days in a week, so at most you should only have 7. Use an IF column to convert the number to the day.

IF 1 THEN Sunday  
ELSEIF 2 THEN Monday  
etc.

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [August 8, 2021, 7:30pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/7 "2021-08-08T19:30:03Z")

</div>

I am a practical type of learner.  
Let’s use 09/06/2021 for example and then you can explain from there because when I use the math column, I get the number ‘6’ as answer…

---

<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:** [August 8, 2021, 7:31pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/8 "2021-08-08T19:31:01Z")

</div>

What formula are you using. Seems like you may be using DAY(date). It should be WEEKDAY(date).

Edit: How do you read dates? Is that September 6th, or June 9th?

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [August 8, 2021, 7:31pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/9 "2021-08-08T19:31:55Z")

</div>

Ahhhh…Sorry, I had a “blonde” moment there for a minute. I wrote “day” instead of “WEEKDAY”…  
Let me get to it …

Thanks Jeff

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [August 8, 2021, 7:32pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/10 "2021-08-08T19:32:48Z")

</div>

It’s 6 September. But my issue was as explained in my previous response…

---

<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:** [August 8, 2021, 7:44pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/11 "2021-08-08T19:44:54Z")

</div>

Just thinking about @Uzo’s suggestion to use a template. That may actually be a little more efficient compared to an IF column. Point the template column template setting to the math column. Then create replacement values for each day. @Darren_Murphy has used a different method of a separate table to store each day in a row, then use a single value column to use the weekday number as an index to select the correct day row in the separate table. It’s useful if you have to check the weekday several times in you app. If it’s only once or twice, then it’s just easier to use the IF column or TEMPLATE column to convert the number to the day.

---

<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:** [August 9, 2021, 1:43am UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/12 "2021-08-09T01:43:27Z")

</div>

> [@Jeff\_Hager](#):
>
> It’s useful if you have to check the weekday several times in you app.

yep, and that’s what led me to the single value lookup solution. It became tedious (and error-prone) to keep re-defining that ugly if-then-else column over and over again…

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [August 9, 2021, 4:02am UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/13 "2021-08-09T04:02:41Z")

</div>

My 2 cents to make simpler this solution using Hell Yes-Code:

```auto
let d = new Date();
const week = ["Sunday","Monday","Tuesday","Wendesday","Thursday","Friday","Saturday”];

return week[d.getDay()]

```

Saludos!

---

<div class="post-metadata">

**Author:** ![Toluca100a](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/toluca100a/32/36218_2.png) [@Toluca100a](https://community.glideapps.com/u/Toluca100a)\
**Post date:** [October 31, 2021, 10:59pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/14 "2021-10-31T22:59:16Z")

</div>

Donde pones el código para calcular el día?.. Template?..Math?.. y donde pones la fecha a calcular?

Where do you use this code to calculate the day?  
Template?. Math?.. and where do you insert the date to be calculated from?

Gracias,

MGarza

---

<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:** [October 31, 2021, 11:31pm UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/15 "2021-10-31T23:31:14Z")

</div>

If you’re talking about @gvalero’s code, use the link below in your Experimental Code. I adapted it to my Replit.

```auto
https://get-weekday-from-time.thinhdinh.repl.co

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/2/724bae6d4308bf29eedfcff005e43dad5f5de977.png)

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

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [November 1, 2021, 12:21am UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/16 "2021-11-01T00:21:06Z")

</div>

Hola,

Your plan B if you don’t want to use the Thind’s plugin is to work with Glide’s [JavaScript pluging](https://www.glideapps.com/plugins/hell-yes-code)

`https://column.sh/hell-yes-code`

Saludos

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [November 1, 2021, 12:24am UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/17 "2021-11-01T00:24:39Z")

</div>

You should not use JavaScript for this. Use the [Format Date column](https://www.glideapps.com/plugins/format-date), with format `cccc`:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/b/7bb92f8f02635ede959e41367f640a74551162d3.jpeg)

---

<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:** [November 2, 2021, 12:25am UTC](https://community.glideapps.com/t/extracting-the-day-of-the-week-from-the-date/30189/18 "2021-11-02T00:25:14Z")

</div>

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