How to get the name of the day only? (Without all the full date but only the day)

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

How to get the name of the day only? (Without all the full date but only the day)

Post by liveCode » Tue Mar 22, 2022 4:36 pm

How to get the name of the day only? (Without all the full date but only the day)

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by jmburnod » Tue Mar 22, 2022 4:42 pm

Hi,
The long date is what you looking for

Code: Select all

put the long date

return "tuesday, march 22,2022"
Best
Jean-Marc
https://alternatic.ch

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by liveCode » Tue Mar 22, 2022 4:52 pm

But I want him to return only the day without the date for example if today is Tuesday then he will return "Tuesday"

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by jmburnod » Tue Mar 22, 2022 4:54 pm

Code: Select all

put item 1 of the long date into tDay
put tDay
https://alternatic.ch

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by liveCode » Tue Mar 22, 2022 4:57 pm

Thank you.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by richmond62 » Tue Mar 22, 2022 5:08 pm

This is the moment to point out that item delimiters
(unless otherwise specified) are commas in LiveCode.

So, knowing that, it is very easy to chop up information into useful pieces, so,
for instance from the long date:

item one is the day,

item 2 is the date and month,

and item 3 is the year.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by dunbarx » Tue Mar 22, 2022 6:18 pm

What everyone said.

When Jean-Marc gave you the output of the long date, and you did not immediately see that you could very easily extract "Tuesday" from that string, means you need to learn, as soon as possible, about how LiveCode handles text, especially regarding what are known as "chunks". Chunks are simply parts of a body of text, separated in certain ways. Words are separated by spaces, lines by returns, and others.

Richmond tells you that you can deal with text by parsing into "items", usually delimited by commas. Know that items can be delimited by any string, such as:

Code: Select all

cat,dog,mouse --comma is the delimiter
cat=dog=mouse  --"=" is the delimiter
catXXXXdogXXXXmouse  --"XXXX" is the delimiter
In any of the above, if you set the itemDelimiter to the string shown, then item 2 of any of the above lines would give you "dog".

Craig

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

Re: How to get the name of the day only? (Without all the full date but only the day)

Post by liveCode » Tue Mar 22, 2022 7:39 pm

Thank you very much I learned a lot from you

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”