Inserting the computers current year into a program

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DariusPenta
Posts: 2
Joined: Mon Nov 16, 2015 8:26 pm

Inserting the computers current year into a program

Post by DariusPenta » Mon Nov 16, 2015 8:32 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Inserting the computers current year into a program

Post by dunbarx » Mon Nov 16, 2015 8:48 pm

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

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Inserting the computers current year into a program

Post by quailcreek » Mon Nov 16, 2015 9:36 pm

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
Tom
MacBook Pro OS Mojave 10.14

DariusPenta
Posts: 2
Joined: Mon Nov 16, 2015 8:26 pm

Re: Inserting the computers current year into a program

Post by DariusPenta » Tue Nov 17, 2015 8:36 am

Great! Thanks for the fast replies guys , they were really helpful.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Inserting the computers current year into a program

Post by Klaus » Tue Nov 17, 2015 11:28 am

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

Post Reply