# Current Day vs Selected Day

**URL:** <https://community.thunkable.com/t/current-day-vs-selected-day/1581333>\
**Category:** Questions about Thunkable X\
**Created:** [October 26, 2021, 6:18am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333 "2021-10-26T06:18:55Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 28, 2021, 3:02pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/21 "2021-10-28T15:02:16Z")

</div>

Sorry maybe click on it and it will expand?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 28, 2021, 3:04pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/22 "2021-10-28T15:04:00Z")

</div>

I believe something wrong with the forum server/app. Let’s wait for a while and check later.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 28, 2021, 3:49pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/23 "2021-10-28T15:49:55Z")

</div>

> [@jakeheron](#):
>
> The last small thing is creating a condition that labels tasks due soon. I have had a go at implementing this:
> 
> ![Screen Shot 2564-10-28 at 21.39.10](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7ccb42e1e65a5ecb50a0ecf5686f4321a74465f6.png)

You are subtracting the `app variable current date` from itself. This will yield ZERO all the time.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 7:08am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/24 "2021-10-30T07:08:00Z")

</div>

Thank you, @muneer , I have fixed this. I have created conditions that change the label for the assignment depending on its due date:

 ![Screen Shot 2564-10-30 at 14.04.09](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/3/632a286d63c3c4cda9a8e842c688054327f788cc.png)

However, the logic statement `app variable current date = app variable assignment date` is not returning true. I have checked to see if the the two variables are the same if I set the assignment due date as the same current date and they are indeed the same. Therefore, why won’t this logic statement returning true?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 7:14am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/25 "2021-10-30T07:14:27Z")

</div>

Can you check the length of both variables?

If could be a `white space` in the start or the end of the variable that preventing it from evaluating to true.

Also noticed that your last condition in impossible. The value cannot be \<= and at the same time \> the same value.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 7:19am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/26 "2021-10-30T07:19:56Z")

</div>

@muneer

Thanks for correcting the last condition. I have tested the lengths of each variable and they are indeed the same. Whats more is that I set a label’s text to `current date - assignment date` and the label displayed 0.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 7:35am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/27 "2021-10-30T07:35:21Z")

</div>

> [@jakeheron](#):
>
> text to `current date - assignment date` and the label displayed 0.

Good.  
So if you change the condition from equality to testing for ZERO then it should solve your issue.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 7:43am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/28 "2021-10-30T07:43:57Z")

</div>

@muneer

This condition still doesn’t work. I have added a link if you would like to take a look:

[https://x.thunkable.com/copy/685a2b4670ffa54befe4a72fff789836](https://x.thunkable.com/copy/685a2b4670ffa54befe4a72fff789836)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 10:26am UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/29 "2021-10-30T10:26:20Z")

</div>

The snippet causes the two dates not to be equal.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/0/00dde9b34daa79b4b4a008e33386104750d6aa4a.png)

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 12:01pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/30 "2021-10-30T12:01:27Z")

</div>

Thank you @muneer for noticing this. I have now noticed that, once the current date was corrected, the assignment date and current date are not the same. I have printed each date for October 30 2021:

assignment due date = 202101030  
current date = 20211030

It seems that an extra ‘0’ has been added in the parsing algorithm. Any way to fix this?

Thanks!

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 12:05pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/31 "2021-10-30T12:05:23Z")

</div>

This is the source of the extra “0”

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/1/f1cf980d2eac8eaf97463ad4d486f7ef460414c1.png)

I have previously asked you to get the length of both variables. You should have noticed this problem at that stage.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 12:08pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/32 "2021-10-30T12:08:28Z")

</div>

This is the code you kindly supplied earlier:

 ![Screen Shot 2564-10-30 at 19.07.00](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/6/b6107fb0437e84f389d33319ab8d21aec473ccf2.png)

Should I change it to:

```auto
in list app variable month list:
find first occurence of current month

```

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 12:09pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/33 "2021-10-30T12:09:59Z")

</div>

Then I was wrong.  
The second variable should be `app variable month`

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/8/98d00ef8e4a7fbb37b38d57584f5c7ed55507b10.png)

This is the correct setup.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 12:33pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/34 "2021-10-30T12:33:10Z")

</div>

Thanks @muneer . I am very sorry that this is getting increasingly complex, but I have found another major issue. The current conditions set up work if the current month and the assignment month **are the same**. Otherwise, the logic doesn’t work. Here is the current conditions:

 ![Screen Shot 2564-10-30 at 19.29.13](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/5/258274b5748f7fd0e5bb9106f42b4b455534d046.png)

Here, if the say the assignment month is October and the current month is October, all the logic will work. However, I tested if I set the assignment month to November and the logic fails. For instance, `app variable assignment date - app variable current date = 71` whereas if both have the month October it = 0. I am completely stumped as to get around this!

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 12:45pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/35 "2021-10-30T12:45:36Z")

</div>

Can you give more info?  
What values you used for `Assignment Date` and for `Current Date`?  
Can you print them to a label and then subtract them by using the calculator? This is just to confirm if the number given is correct.

For Example:  
If `Current Date` is today (20211030) and `Assignment Date` is the 1st of November then the difference is **71** as numbers not as dates.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 12:51pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/36 "2021-10-30T12:51:29Z")

</div>

@muneer For assignment date I have used 1 November = 20211101 and current date is today. Yes, these dates are only 2 days away however, when their numerical forms are subtracting from one another, it equals 71. Therefore, the conditions in which check the numerical forms (parsed from the string date) of each date will not work. Does this clarify? Thanks.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 1:43pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/37 "2021-10-30T13:43:15Z")

</div>

Let’s think out of the box.  
Linking a Google spread sheet and pass the dates to it will quickly give you the difference between the dates without all these blocks.

Another way, is to take the year and add to it the number of days from the start of the year to date.  
This means you need to create a list with number of days in each month or number of days accumulated until the previous month and add the number of days to it.

Example  
year is 2021  
Add to it the number of days till September because we are in October

- 31
- 28 or 29
- 31
- 30
- 31
- 30
- 31
- 31
- 30

Then add the number of days in the current month which for today is 30

You get a total of 2324

The assignment date being the first of November will be 2326

This will assure you correct number of days based in calendar days.

One issue remains which is a function to determine if the year is a leap year to add **1** to the total.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 2:04pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/38 "2021-10-30T14:04:38Z")

</div>

@muneer these are great suggestions.

I have not had a lot of experience using google sheets with Thunkable so how would that work exactly?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 30, 2021, 2:15pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/39 "2021-10-30T14:15:39Z")

</div>

You have used `Local Tables` in your app. So I assume you know how to add a table but instead of choosing make your own table you will choose Google sheet  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/d/fd4030a1a7117abb0e70aa2e91bcdace25ba660d.png)

From the `Data Source`, you will click on the **+** and click on `Create New` button.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/5/15c4bfc3c3c5581af4adc03ec1196982dca4357d.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/4/9496a3e832e79037f9115a58e437c09da806c736.png)  
Select `Google sheet`. This will take you to this screen  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/9/a903e42bca7bb86f24c133f922e9ca01063e8427.png)

click on `Select a Sheet`  
You will get a list of Google sheets available in your Google drive. Select the required sheet and that’s it. You would have created the connection to your Google sheet in your app and now you can write to the sheet and read from it.

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 30, 2021, 3:40pm UTC](https://community.thunkable.com/t/current-day-vs-selected-day/1581333/40 "2021-10-30T15:40:05Z")

</div>

@muneer I understand linking google sheets but how would you compare the dates using it?

[Previous page](https://community.thunkable.com/t/current-day-vs-selected-day/1581333.md?page=1)

[Next page](https://community.thunkable.com/t/current-day-vs-selected-day/1581333.md?page=3)
