Re: Dual Purpose Applet Question
Re: Dual Purpose Applet Question
- Subject: Re: Dual Purpose Applet Question
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 05 Dec 2000 11:44:04 -0800
On 12/5/00 11:26 AM, "Mr Tea" <email@hidden> wrote:
>
set theName to (day of (current date) as string) & " " &
>
(characters 1 thru 3 of (month of (current date) as string) as string)
>
& " " & (year of (current date) as string) & " - " & time string of (current
date)
Now, if anyone can suggest a neater way of setting 'theName'...
A string operand on the left of the concatenation operator "&" coerces the
operand on the right to string if possible. Also "text 1 thru x" is better
and quicker than "characters 1 thru x" (which is a list, then coerced to a
string). And don't keep evaluating 4 times over: do it once and set it as a
variable. So, what is effectively the same as what you have, but "neater":
set cd to (current date)
set theName to "" & (day of cd) & " " & (text 1 thru 3 of ("" & (month
of cd))) & " " & (year of cd) & " - " & time string of cd
-- "5 Dec 2000 - 11:38:01 AM"
Or, even neater, use Akua Sweets:
set theName to the clock using form "%d %nm %c%y - %T"
--
Paul Berkowitz