Re: Script performance and Safari
Re: Script performance and Safari
- Subject: Re: Script performance and Safari
- From: Nigel Garvey <email@hidden>
- Date: Sun, 15 Apr 2012 11:56:12 +0100
Christopher Stone wrote on Sat, 14 Apr 2012 10:10:41 -0500:
>Yes that's better, but let's simplify a trifle more — and make certain
the
>day is single-digit when available.
>
>tell (current date) to set dateStr to "" & (its month as number) & "/" &
>(its day as number) & "/" & (its year) mod (((its year) div 1000) *
1000)
Hi, Chris.
Even that contains an unnecessary text concatenation, a redundant
integer-to-number coercion, an additional year extraction, and two
superfluous math operations!
tell (current date) to set dateStr to (its month as number as text) & "/" & (its day) & "/" & (its year) mod 100
This will give two-digit years for the rest of most of our lifetimes,
but more a bit more code is needed to guarantee it with any year. In
Snow Leopard, AppleScript dates before 15th October 1582 are totally
screwed and their use is best avoided. (Their text representations are,
presumably, Julian, whereas their other properties are still proleptic
Gregorian.)
tell date "Saturday 25 December 1400 00:00:00" to return {its short date string, its year, its month, its day}
--> {"25/12/1400", 1401, January, 3}
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden