Display Day of Week


I have been able to set label text to show dates as follows:

Today: xx/x/xxxx (using “current day of the week”)
Yesterday: xx/x/xxxx (using “current day of the week -1”)

Challenge I have is I want to show 3 days ago as:

Saturday: xx/x/xxxx

Not sure how to do that.

Without a complete date picker and advanced clock functions like on ‘classic’, it is indeed a bit more delicate on X.

Basically, you start by taking “current day of the week -3” and check if the number is zero or negative. If it is, you add 7. But to return the corresponding day of the week as a name, you probably need to have a pre-set list of all 7 names, and you use the index you just calculated (between 1 and 7) to extract the required element and patch it to your output string.

You will have to do similar gymnastic to get the day of the month in order, i.e. subtracting 3 from the current day could cause a roll-over to the previous month, which means that you would need a list of month duration, which may require additional processing if you want to cater for leap years (for the record, you may be OK for the next 81 year assuming that February has 29 days every 4 years; but 2100 will NOT be a leap year, and neither will 2200 or 2300 be. 2400 will be a leap year, as 2000 was).
And you also need to roll-over the year, if “today” is January 1st.

Actually, you should already have been facing that problem if “today” is the first of the month, since yesterday would be the last day of the previous month. Have you addressed that?

hmm I had a feeling this would an impossible task so i have decided to play it simple and redesign the app without having to display previous days name especially as you have pointed out last day of month against previous month.

Thanks for the reply.

Oh, it is NOT impossible, it is just a bit more complicated.
I have just this kind of processing (the leap year management) in one of my app (though it is in MIT App Inventor, not thunkable).

Yes I know it can be done with other tools but not thunkable x

If you only need to display the data and you are familiar with JavaScript, then I could recommend solving this problem using JavaScript in WebViewer. But the data: protocol works only in Live (and does not work in an iOS-installed application).

As far as I can tell, all the tools required to make it in X are there.
You simply need to supplement with lists that contain the information that would be part of the time management tools that are presently not offered. And that would be a list of how many days you have in each month, plus some logic to change the value extracted from the list for entry #2 if the year is a leap.

So , it SHOULD be possible in X.