Re: Number of days left in the month
Re: Number of days left in the month
- Subject: Re: Number of days left in the month
- From: Nigel Garvey <email@hidden>
- Date: Sat, 23 Nov 2002 11:19:00 +0000
"Arthur J. Knapp" wrote on Fri, 22 Nov 2002 12:21:10 -0500:
>
> Subject: Re: Number of days left in the month
>
> Date: Fri, 22 Nov 2002 09:46:13 +0000
>
> From: Nigel Garvey <email@hidden>
>
>
>> Emmanuel also wrote on Thu, 21 Nov 2002 22:56:51 +0100:
>
>>> tell theDate to 32 - (((date ("1 " & its month & " " & its year)) +
>
>>> 31 * days)'s day) returning x
>
>
>> Or, about twice as fast (on my machines):
>
>> tell (date (theDate's date string)) to 32 - ((it + (32 - (its day)) *
>
>> days)'s day) returning x
>
>
> Emmanuel will immediately have spotted (as will Arthur, has, etc.) that
>
> the string's a complete waste of time in my version, so:
>
>
>
> tell theDate to 32 - ((it + (32 - (its day)) * days)'s day) returning x
>
>
>
> ... which is very much faster still. :-)
>
>
Alright, the pressure is on: One of you two should be able to get this
>
down to exactly 7 characters of source code...
That sounds more John Delacour's province. ;-)
In mine, the one-liner for returning the number of complete days left in
the month would be:
tell (32 - (theDate's day)) to set x to it - ((theDate + it * days)'s
day)
But is it "maintainable"? ;-)
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.