Page 1 of 1

Inserting the computers current year into a program

Posted: Mon Nov 16, 2015 8:32 pm
by DariusPenta
Hello, im totally new to livecode and just wondering if someone could please tell me how to display the computers current date (specifically just the year) in a program.

regards-

some guy behind a monitor

Re: Inserting the computers current year into a program

Posted: Mon Nov 16, 2015 8:48 pm
by dunbarx
Hi.

Welcome to LC.

Among the key native features of the language are "properties". One of these is "the date", and it comes in several flavors. Please look this up in the dictionary.

Once you have that, there are a couple of ways to extract the year. Put this in a button script:

Code: Select all

on mouseUp
   answer the long date
end mouseUp
Do you know what an "item" is? If not, you need to right away. See "the itemDelimiter" in the dictionary, and read about it in the user manual. You have your way forward.

Now read up on the "convert" command. What might you do with that?

Craig Newman

Re: Inserting the computers current year into a program

Posted: Mon Nov 16, 2015 9:36 pm
by quailcreek
After you've done the research Craig suggested, thy this.

Code: Select all

on mouseUp
   put the long date into tDate
   answer item 3 of tDate
end mouseUp

Re: Inserting the computers current year into a program

Posted: Tue Nov 17, 2015 8:36 am
by DariusPenta
Great! Thanks for the fast replies guys , they were really helpful.

Re: Inserting the computers current year into a program

Posted: Tue Nov 17, 2015 11:28 am
by Klaus
Hi Darius,

1. welcome to the forum! :D

2. Please checke these stacks to learn more about the very basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus